Compare commits
102 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
225e4b94cb | ||
![]() |
3e676eb12f | ||
![]() |
2257b800ac | ||
![]() |
290df2e1de | ||
![]() |
4be697e5c1 | ||
![]() |
08bdadbf31 | ||
![]() |
734739187b | ||
![]() |
1c4a51c39c | ||
![]() |
0aa2e5f728 | ||
![]() |
5e615f4eb4 | ||
![]() |
9e82732dd4 | ||
![]() |
0454dc247a | ||
![]() |
24f3463bff | ||
![]() |
095e1f37c4 | ||
![]() |
f4334e9bdf | ||
![]() |
838f22259a | ||
![]() |
b3480d31b0 | ||
![]() |
8dd7bb48fc | ||
![]() |
44d1688164 | ||
![]() |
a7d8fc280c | ||
![]() |
e9a84e0a21 | ||
![]() |
d09218823c | ||
![]() |
ae9bc0d72f | ||
![]() |
09ba1b289f | ||
![]() |
9f3c31cd8d | ||
![]() |
eb18a1fe29 | ||
![]() |
789668deb3 | ||
![]() |
e791d753be | ||
![]() |
e0e6d96d69 | ||
![]() |
ee18dd2b88 | ||
![]() |
09132c732a | ||
![]() |
f19063ac71 | ||
![]() |
a17440713a | ||
![]() |
bd03d374b7 | ||
![]() |
06e12e4ba8 | ||
![]() |
f059ce7682 | ||
![]() |
286685cb72 | ||
![]() |
7c62555bcf | ||
![]() |
2699d8ff7e | ||
![]() |
5a8f1aef55 | ||
![]() |
9c034dc326 | ||
![]() |
f8cad00948 | ||
![]() |
c128b969bb | ||
![]() |
f59664a01f | ||
![]() |
67f43d2124 | ||
![]() |
0ae5848245 | ||
![]() |
9f02b291ac | ||
![]() |
2b77ba0b75 | ||
![]() |
6f90be2971 | ||
![]() |
110063c585 | ||
![]() |
51d0a54555 | ||
![]() |
c31a80c9ed | ||
![]() |
79afb279c2 | ||
![]() |
3c8d3a6565 | ||
![]() |
01f9d0d9bf | ||
![]() |
3111988680 | ||
![]() |
1ebbe2eb7b | ||
![]() |
65d16d1914 | ||
![]() |
da5a44cfb7 | ||
![]() |
75b8b144a1 | ||
![]() |
1363167d65 | ||
![]() |
d15c15c8f5 | ||
![]() |
9288d21b9f | ||
![]() |
cafe6675c2 | ||
![]() |
fba4d28433 | ||
![]() |
b7774da97c | ||
![]() |
3c1a083e5c | ||
![]() |
0f294d90b2 | ||
![]() |
a2dbecfcd6 | ||
![]() |
604c09b1da | ||
![]() |
f9c8b3112a | ||
![]() |
bb75d16521 | ||
![]() |
ca8f1c1ba3 | ||
![]() |
94cc856cb8 | ||
![]() |
827a5b1a80 | ||
![]() |
393da0c370 | ||
![]() |
82fe4ea0a5 | ||
![]() |
ffbd37d784 | ||
![]() |
ab94a204e0 | ||
![]() |
6058b06b86 | ||
![]() |
26aea0299a | ||
![]() |
0a80cda0ea | ||
![]() |
6f0500ed4a | ||
![]() |
746135dd1e | ||
![]() |
a762dedb60 | ||
![]() |
a0c915b1e4 | ||
![]() |
99df3d22be | ||
![]() |
be98291caf | ||
![]() |
33782aebbf | ||
![]() |
55a12055c5 | ||
![]() |
25111d717e | ||
![]() |
819ea38651 | ||
![]() |
143420bc05 | ||
![]() |
986b12d391 | ||
![]() |
f81c864eed | ||
![]() |
aac3a0652a | ||
![]() |
a0eadcdc64 | ||
![]() |
e331e06a39 | ||
![]() |
7047294617 | ||
![]() |
1caaeaae1e | ||
![]() |
d63a4e285e | ||
![]() |
9a9c67d61b |
47
.travis.yml
Normal file
47
.travis.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
language: generic
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
env:
|
||||
matrix:
|
||||
- IMAGE=latest
|
||||
- IMAGE=latest TESTS=01
|
||||
- IMAGE=latest TESTS=12
|
||||
- IMAGE=latest TESTS=20
|
||||
- IMAGE=latest TESTS=50
|
||||
- IMAGE=latest TESTS=30
|
||||
- IMAGE=latest TESTS=31
|
||||
- IMAGE=latest TESTS=70
|
||||
- IMAGE=latest TESTS=99
|
||||
- IMAGE=latest TESTS=02
|
||||
- IMAGE=latest TESTS=03
|
||||
- IMAGE=latest TESTS=04
|
||||
- IMAGE=latest TESTS=10
|
||||
- IMAGE=latest TESTS=11
|
||||
- IMAGE=latest TESTS=13
|
||||
- IMAGE=latest TESTS=14
|
||||
- IMAGE=latest TESTS=15
|
||||
- IMAGE=latest TESTS=17
|
||||
|
||||
before_script:
|
||||
- docker pull fedora:$IMAGE
|
||||
- |
|
||||
sudo modprobe kvm-intel nested=1 || :
|
||||
sudo modprobe kvm-amd nested=1 || :
|
||||
dmesg | tail || :
|
||||
- git pull --depth=100
|
||||
- |
|
||||
git describe --abbrev=0 --tags || :
|
||||
git describe --tags || :
|
||||
|
||||
script:
|
||||
- docker run --privileged -it -v $(pwd)/:/dracut fedora:$IMAGE /dracut/fedora-test.sh $IMAGE-$$ "$TESTS"
|
||||
|
||||
notifications:
|
||||
webhooks:
|
||||
urls:
|
||||
- https://webhooks.gitter.im/e/effa917ca3e0ed5fd00e
|
||||
on_success: change # options: [always|never|change] default: always
|
||||
on_failure: always # options: [always|never|change] default: always
|
||||
on_start: never # options: [always|never|change] default: always
|
||||
|
68
51-dracut-rescue-postinst.sh
Executable file
68
51-dracut-rescue-postinst.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
export LANG=C
|
||||
|
||||
KERNEL_VERSION="$1"
|
||||
KERNEL_IMAGE="$2"
|
||||
|
||||
[[ -f /etc/os-release ]] && . /etc/os-release
|
||||
|
||||
if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then
|
||||
systemd-machine-id-setup
|
||||
fi
|
||||
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
[[ $MACHINE_ID ]] || exit 1
|
||||
[[ -f $KERNEL_IMAGE ]] || exit 1
|
||||
|
||||
INITRDFILE="/boot/initramfs-0-rescue-${MACHINE_ID}.img"
|
||||
NEW_KERNEL_IMAGE="${KERNEL_IMAGE%/*}/vmlinuz-0-rescue-${MACHINE_ID}"
|
||||
|
||||
[[ -f $INITRDFILE ]] && [[ -f $NEW_KERNEL_IMAGE ]] && exit 0
|
||||
|
||||
dropindirs_sort()
|
||||
{
|
||||
suffix=$1; shift
|
||||
args=("$@")
|
||||
files=$(
|
||||
while (( $# > 0 )); do
|
||||
for i in ${1}/*${suffix}; do
|
||||
[[ -f $i ]] && echo ${i##*/}
|
||||
done
|
||||
shift
|
||||
done | sort -Vu
|
||||
)
|
||||
|
||||
for f in $files; do
|
||||
for d in "${args[@]}"; do
|
||||
if [[ -f "$d/$f" ]]; then
|
||||
echo "$d/$f"
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# source our config dir
|
||||
for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
|
||||
[[ $dracut_rescue_image != "yes" ]] && exit 0
|
||||
|
||||
if [[ ! -f $INITRDFILE ]]; then
|
||||
dracut --no-hostonly -a "rescue" "$INITRDFILE" "$KERNEL_VERSION"
|
||||
((ret+=$?))
|
||||
fi
|
||||
|
||||
if [[ ! -f $NEW_KERNEL_IMAGE ]]; then
|
||||
cp --reflink=auto "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
|
||||
((ret+=$?))
|
||||
fi
|
||||
|
||||
new-kernel-pkg --install "$KERNEL_VERSION" --kernel-image "$NEW_KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$NAME $VERSION_ID Rescue $MACHINE_ID"
|
||||
|
||||
((ret+=$?))
|
||||
|
||||
exit $ret
|
16
AUTHORS
16
AUTHORS
@@ -14,20 +14,22 @@ Daniel Molkentin <dmolkentin@suse.com>
|
||||
Amerigo Wang <amwang@redhat.com>
|
||||
Thomas Renninger <trenn@suse.com>
|
||||
Lukas Nykryn <lnykryn@redhat.com>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
Alexander Tsoy <alexander@tsoy.me>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Frederick Grose <fgrose@sugarlabs.org>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Frederick Grose <fgrose@sugarlabs.org>
|
||||
Peter Robinson <pbrobinson@fedoraproject.org>
|
||||
Fabian Vogt <fvogt@suse.com>
|
||||
Kairui Song <kasong@redhat.com>
|
||||
John Reiser <jreiser@bitwagon.com>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
Xunlei Pang <xlpang@redhat.com>
|
||||
Daniel Drake <drake@endlessm.com>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Angelo "pallotron" Failla <pallotron@fb.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
@@ -38,6 +40,7 @@ Brendan Germain <brendan.germain@nasdaqomx.com>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Leho Kraav <leho@kraav.com>
|
||||
Moritz Maxeiner <moritz@ucworks.org>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
Ondrej Mosnacek <omosnace@redhat.com>
|
||||
Fabian Deutsch <fabiand@fedoraproject.org>
|
||||
Javier Martinez Canillas <javierm@redhat.com>
|
||||
@@ -45,7 +48,6 @@ Kamil Rytarowski <n54@gmx.com>
|
||||
Lidong Zhong <lidong.zhong@suse.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
NeilBrown <neilb@suse.de>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Radek Vykydal <rvykydal@redhat.com>
|
||||
Thorsten Behrens <tbehrens@suse.com>
|
||||
@@ -69,7 +71,6 @@ Dennis Gilmore <dennis@ausil.us>
|
||||
Jan Synacek <jsynacek@redhat.com>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
Juan RP <xtraeme@gmail.com>
|
||||
Kairui Song <kasong@redhat.com>
|
||||
Lance Albertson <lance@osuosl.org>
|
||||
Marcos Mello <marcosfrm@gmail.com>
|
||||
Marian Ganisin <mganisin@redhat.com>
|
||||
@@ -105,7 +106,6 @@ Julian Wolf <juwolf@suse.com>
|
||||
Koen Kooi <koen@dominion.thruhere.net>
|
||||
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Kyle McMartin <kmcmarti@redhat.com>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Lukas Wunner <lukas@wunner.de>
|
||||
Mike Snitzer <snitzer@redhat.com>
|
||||
Minfei Huang <mhuang@redhat.com>
|
||||
@@ -117,6 +117,7 @@ Robert Scheck <robert@fedoraproject.org>
|
||||
Stefan Berger <stefanb@us.ibm.com>
|
||||
Thomas Lange <lange@informatik.uni-koeln.de>
|
||||
Till Maas <opensource@till.name>
|
||||
Tony Asleson <tasleson@redhat.com>
|
||||
Vivek Goyal <vgoyal@redhat.com>
|
||||
Vladislav Bogdanov <bubble@hoster-ok.com>
|
||||
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
|
||||
@@ -143,6 +144,7 @@ Derek Higgins <derekh@redhat.com>
|
||||
Duane Griffin <duaneg@dghda.com>
|
||||
Elan Ruusamäe <glen@delfi.ee>
|
||||
Enno Boland <g@s01.de>
|
||||
Eugene Syromiatnikov <esyr@redhat.com>
|
||||
Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
|
||||
Florian Gamböck <mail@floga.de>
|
||||
François Cami <fcami@fedoraproject.org>
|
||||
@@ -205,11 +207,11 @@ Sullivan (CTR), Austin <austin.sullivan.ctr@progeny.net>
|
||||
Thilo Bangert <thilo.bangert@gmx.net>
|
||||
Thomas Blume <thomas.blume@suse.com>
|
||||
Tobias Geerinckx <tobias.geerinckx@gmail.com>
|
||||
Tobias Klauser <tklauser@distanz.ch>
|
||||
Tom Gundersen <teg@jklm.no>
|
||||
Tomasz Paweł Gajc <tpgxyz@gmail.com>
|
||||
Tomasz Torcz <tomek@pipebreaker.pl>
|
||||
Tong Li <tonli@redhat.com>
|
||||
Tony Asleson <tasleson@redhat.com>
|
||||
Vadim Kuznetsov <vadimk@gentoo.org>
|
||||
Vaughan Cao <vaughan.cao@oracle.com>
|
||||
Vratislav Podzimek <vpodzime@redhat.com>
|
||||
|
7
Makefile
7
Makefile
@@ -1,7 +1,7 @@
|
||||
-include dracut-version.sh
|
||||
|
||||
VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION))
|
||||
GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
|
||||
VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags --always 2>/dev/null || echo $(DRACUT_VERSION))
|
||||
GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags --always 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
|
||||
|
||||
-include Makefile.inc
|
||||
|
||||
@@ -63,6 +63,9 @@ install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h ins
|
||||
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(KMOD_LIBS)
|
||||
|
||||
logtee: logtee.c
|
||||
$(CC) $(LDFLAGS) -o $@ $<
|
||||
|
||||
dracut-install: install/dracut-install
|
||||
ln -fs $< $@
|
||||
|
||||
|
60
NEWS
60
NEWS
@@ -1,4 +1,62 @@
|
||||
dracut-047
|
||||
dracut-049
|
||||
==========
|
||||
lsinitrd:
|
||||
- record loaded kernel modules when hostonly mode is enabled
|
||||
lsinitrd $image -f */lib/dracut/loaded-kernel-modules.txt
|
||||
- allow to only unpack certain files
|
||||
|
||||
kernel-modules:
|
||||
- add gpio and pinctrl drivers for arm*/aarch64
|
||||
- add nfit
|
||||
|
||||
kernel-network-modules:
|
||||
- add vlan kernel modules
|
||||
|
||||
ifcfg/write-ifcfg.sh:
|
||||
- aggregate resolv.conf
|
||||
|
||||
livenet:
|
||||
- Enable OverlayFS overlay in sysroot.mount generator.
|
||||
|
||||
dmsquash-live:
|
||||
- Support a flattened squashfs.img
|
||||
|
||||
dracut-systemd:
|
||||
- Start systemd-vconsole-setup before dracut-cmdline-ask
|
||||
|
||||
iscsi:
|
||||
- do not install all of /etc/iscsi unless hostonly
|
||||
- start iscsid even w/o systemd
|
||||
|
||||
multipath:
|
||||
- fixed shutdown
|
||||
|
||||
network:
|
||||
- configure NetworkManager to use dhclient
|
||||
|
||||
mdraid:
|
||||
- fixed uuid handling ":" versus "-"
|
||||
|
||||
stratis:
|
||||
- Add additional binaries
|
||||
|
||||
new modules:
|
||||
- 00warpclock
|
||||
- 99squash
|
||||
Adds support for building a squashed initramfs
|
||||
- 35network-legacy
|
||||
the old 40network
|
||||
- 35network-manager
|
||||
alternative to 35network-legacy
|
||||
- 90kernel-modules-extra
|
||||
adds out-of-tree kernel modules
|
||||
|
||||
testsuite:
|
||||
- now runs on travis
|
||||
- support new qemu device options
|
||||
- even runs without kvm now
|
||||
|
||||
dracut-048
|
||||
==========
|
||||
|
||||
dracut.sh:
|
||||
|
@@ -2,6 +2,10 @@
|
||||
|
||||
dracut is an initramfs infrastructure.
|
||||
|
||||
## Travis
|
||||
|
||||
[](https://travis-ci.org/dracutdevs/dracut)
|
||||
|
||||
## CentOS CI
|
||||
|
||||
[](https://ci.centos.org/job/dracut-push-master/)
|
||||
|
@@ -676,6 +676,17 @@ get_ucode_file ()
|
||||
fi
|
||||
}
|
||||
|
||||
# Get currently loaded modules
|
||||
# sorted, and delimited by newline
|
||||
get_loaded_kernel_modules ()
|
||||
{
|
||||
local modules=( )
|
||||
while read _module _size _used _used_by; do
|
||||
modules+=( "$_module" )
|
||||
done <<< "$(lsmod | sed -n '1!p')"
|
||||
printf '%s\n' "${modules[@]}" | sort
|
||||
}
|
||||
|
||||
# Not every device in /dev/mapper should be examined.
|
||||
# If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
|
||||
lvm_internal_dev() {
|
||||
|
@@ -601,7 +601,7 @@ NFS
|
||||
mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given, use
|
||||
dhcp next_server. If server-ip is an IPv6 address it has to be put in
|
||||
brackets, e.g. [2001:DB8::1]. NFS options can be appended with the prefix
|
||||
":" or "," and are seperated by ",".
|
||||
":" or "," and are separated by ",".
|
||||
|
||||
**root=**nfs:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**nfs4:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**__{dhcp|dhcp6}__::
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NFS
|
||||
@@ -838,23 +838,24 @@ Booting live images
|
||||
Dracut offers multiple options for live booted images:
|
||||
|
||||
=====================
|
||||
SquashFS with read-only filesystem image::: The system will boot with a read
|
||||
only filesystem from the SquashFS and apply a writable device-mapper snapshot
|
||||
over the read only filesystem. Using this method ensures a relatively fast
|
||||
boot and lower RAM usage. Users **must be careful** to avoid writing too many
|
||||
blocks to the snapshot volume. Once the blocks of the snapshot overlay are
|
||||
exhausted, the root filesystem becomes read only and may cause application
|
||||
failures. The overlay file is marked 'Overflow', and a difficult recovery is
|
||||
required to repair and enlarge the overlay offline. Non-persistent overlays
|
||||
are sparse files in RAM that only consume content space as required blocks are
|
||||
allocated. They default to an apparent size of 32 GiB in RAM. The size can be
|
||||
adjusted with the **rd.live.overlay.size=** kernel command line option.
|
||||
SquashFS with read-only filesystem image::: The system will boot with a
|
||||
read-only filesystem from the SquashFS and apply a writable Device-mapper
|
||||
snapshot or an OverlayFS overlay mount for the read-only base filesystem. This
|
||||
method ensures a relatively fast boot and lower RAM usage. Users **must be
|
||||
careful** to avoid writing too many blocks to a snapshot volume. Once the
|
||||
blocks of the snapshot overlay are exhausted, the root filesystem becomes
|
||||
read-only and may cause application failures. The snapshot overlay file is
|
||||
marked 'Overflow', and a difficult recovery is required to repair and enlarge
|
||||
the overlay offline. Non-persistent overlays are sparse files in RAM that only
|
||||
consume content space as required blocks are allocated. They default to an
|
||||
apparent size of 32 GiB in RAM. The size can be adjusted with the
|
||||
**rd.live.overlay.size=** kernel command line option.
|
||||
+
|
||||
The filesystem structure is expected to be:
|
||||
The filesystem structure is traditionally expected to be:
|
||||
+
|
||||
[listing]
|
||||
--
|
||||
squashfs.img | Squashfs from LiveCD .iso downloaded via network
|
||||
squashfs.img | SquashFS from LiveCD .iso
|
||||
!(mount)
|
||||
/LiveOS
|
||||
|- rootfs.img | Filesystem image to mount read-only
|
||||
@@ -865,21 +866,35 @@ squashfs.img | Squashfs from LiveCD .iso downloaded via network
|
||||
... |
|
||||
--
|
||||
+
|
||||
Dracut uses this method of live booting by default. No additional command line
|
||||
options are required other than **root=live:<URL>** to specify the location
|
||||
of your squashed filesystem.
|
||||
For OverlayFS mount overlays, the filesystem structure may also be a direct
|
||||
compression of the root filesystem:
|
||||
+
|
||||
[listing]
|
||||
--
|
||||
squashfs.img | SquashFS from LiveCD .iso
|
||||
!(mount)
|
||||
/bin | Live filesystem
|
||||
/boot |
|
||||
/dev |
|
||||
... |
|
||||
--
|
||||
+
|
||||
Dracut uses one of the overlay methods of live booting by default. No
|
||||
additional command line options are required other than **root=live:<URL>** to
|
||||
specify the location of your squashed filesystem.
|
||||
+
|
||||
- The compressed SquashFS image can be copied during boot to RAM at
|
||||
`/run/initramfs/squashed.img` by using the **rd.live.ram=1** option.
|
||||
- A device with a persistent overlay can be booted read only by using the
|
||||
- A device with a persistent overlay can be booted read-only by using the
|
||||
**rd.live.overlay.readonly** option on the kernel command line. This will
|
||||
cause a temporary, writable overlay to be stacked over a read-only snapshot
|
||||
of the root filesystem.
|
||||
either cause a temporary, writable overlay to be stacked over a read-only
|
||||
snapshot of the root filesystem or the OverlayFS mount will use an additional
|
||||
lower layer with the root filesystem.
|
||||
+
|
||||
Uncompressed live filesystem image:::
|
||||
When the live system was installed with the '--skipcompress' option of the
|
||||
__livecd-iso-to-disk__ installation script for Live USB devices, the root
|
||||
filesystem image, `rootfs.img`, is expanded on installation and no SquashFS
|
||||
filesystem image, __rootfs.img__, is expanded on installation and no SquashFS
|
||||
is involved during boot.
|
||||
+
|
||||
- If **rd.live.ram=1** is used in this situation, the full, uncompressed
|
||||
@@ -887,12 +902,12 @@ root filesystem is copied during boot to `/run/initramfs/rootfs.img` in the
|
||||
`/run` tmpfs.
|
||||
+
|
||||
- If **rd.live.overlay=none** is provided as a kernel command line option,
|
||||
a writable, linear device-mapper target is created on boot with no overlay.
|
||||
a writable, linear Device-mapper target is created on boot with no overlay.
|
||||
|
||||
writable filesystem image:::
|
||||
Writable filesystem image:::
|
||||
The system will retrieve a compressed filesystem image, extract it to
|
||||
`/run/initramfs/fsimg/rootfs.img`, connect it to a loop device, create a
|
||||
writable, linear device-mapper target at `/dev/mapper/live-rw`, and mount that
|
||||
writable, linear Device-mapper target at `/dev/mapper/live-rw`, and mount that
|
||||
as a writable volume at `/`. More RAM is required during boot but the live
|
||||
filesystem is easier to manage if it becomes full. Users can make a filesystem
|
||||
image of any size and that size will be maintained when the system boots. There
|
||||
@@ -902,7 +917,7 @@ The filesystem structure is expected to be:
|
||||
+
|
||||
[listing]
|
||||
--
|
||||
rootfs.tgz | Compressed tarball containing fileystem image
|
||||
rootfs.tgz | Compressed tarball containing filesystem image
|
||||
!(unpack)
|
||||
/rootfs.img | Filesystem image at /run/initramfs/fsimg/
|
||||
!(mount)
|
||||
@@ -930,10 +945,11 @@ NOTE: There must be enough free RAM available to hold the complete image.
|
||||
This method is very suitable for diskless boots.
|
||||
|
||||
**root=**live:__<url>__::
|
||||
Boots a live image retrieved from __<url>__. Valid handlers: __http, https, ftp, torrent, tftp__.
|
||||
Boots a live image retrieved from __<url>__. Requires the dracut 'livenet'
|
||||
module. Valid handlers: __http, https, ftp, torrent, tftp__.
|
||||
+
|
||||
[listing]
|
||||
.Example
|
||||
.Examples
|
||||
--
|
||||
root=live:http://example.com/liveboot.img
|
||||
root=live:ftp://ftp.example.com/liveboot.img
|
||||
@@ -945,7 +961,7 @@ Enables debug output from the live boot process.
|
||||
|
||||
**rd.live.dir=**__<path>__::
|
||||
Specifies the directory within the boot device where the squashfs.img or
|
||||
rootfs.img can be found. By default, this is __LiveOS__.
|
||||
rootfs.img can be found. By default, this is `/LiveOS`.
|
||||
|
||||
**rd.live.squashimg=**__<filename of SquashFS image>__::
|
||||
Specifies the filename for a SquashFS image of the root filesystem.
|
||||
@@ -953,35 +969,52 @@ By default, this is __squashfs.img__.
|
||||
|
||||
**rd.live.ram=**1::
|
||||
Copy the complete image to RAM and use this for booting. This is useful
|
||||
when the image resides on, i.e., a DVD which needs to be ejected later on.
|
||||
when the image resides on, e.g., a DVD which needs to be ejected later on.
|
||||
|
||||
**rd.live.overlay=**__<devspec>__:__(<pathspec>|auto)__|__none__::
|
||||
Allow the usage of a permanent overlay.
|
||||
- _<devspec>_ specifies the path to a device with a mountable filesystem.
|
||||
- _<pathspec>_ is the path to a file within that filesystem, which shall be
|
||||
**rd.live.overlay={**__<devspec>__[:__{<pathspec>|auto}__]|__none__}::
|
||||
Manage the usage of a permanent overlay.
|
||||
+
|
||||
--
|
||||
* _<devspec>_ specifies the path to a device with a mountable filesystem.
|
||||
* _<pathspec>_ is the path to a file within that filesystem, which shall be
|
||||
used to persist the changes made to the device specified by the
|
||||
**root=live:__<url>__** option.
|
||||
- _none_ specifies no overlay when an uncompressed live root filesystem is
|
||||
available.
|
||||
If a persistent overlay is detected at the standard LiveOS path, the overlay &
|
||||
overlay type detected (whether Device-mapper or OverlayFS) will be used.
|
||||
+
|
||||
The default _pathspec_, when _auto_ or no _:<pathspec>_ is given, is
|
||||
`/<+++<b>rd.live.dir</b>+++>/overlay-<label>-<uuid>`, where _<label>_ is the
|
||||
device LABEL, and _<uuid>_ is the device UUID.
|
||||
* _none_ (the word itself) specifies that no overlay will be used, such as when
|
||||
an uncompressed, writable live root filesystem is available.
|
||||
+
|
||||
If a persistent overlay __is detected__ at the standard LiveOS path, the
|
||||
overlay & overlay type detected, whether Device-mapper or OverlayFS, will be
|
||||
used.
|
||||
--
|
||||
+
|
||||
[listing]
|
||||
.Example
|
||||
.Examples
|
||||
--
|
||||
rd.live.overlay=/dev/sdb1:persistent-overlay.img
|
||||
rd.live.overlay=UUID=99440c1f-8daa-41bf-b965-b7240a8996f4
|
||||
--
|
||||
|
||||
**rd.live.overlay.size=**__<size_MiB>__::
|
||||
Specifies a non-persistent overlay size in MiB. The default is _32768_.
|
||||
Specifies a non-persistent Device-mapper overlay size in MiB. The default is
|
||||
_32768_.
|
||||
|
||||
**rd.live.overlay.readonly=**1::
|
||||
Specifies a non-persistent, writable snapshot overlay to be stacked over a
|
||||
read-only snapshot of the root filesystem, `/dev/mapper/live-ro`, or a read-
|
||||
only loop device of a writable `rootfs.img`.
|
||||
This is used to boot with a normally read-write persistent overlay in a
|
||||
read-only mode. With this option, either an additional, non-persistent,
|
||||
writable snapshot overlay will be stacked over a read-only snapshot,
|
||||
`/dev/mapper/live‑ro`, of the base filesystem with the persistent overlay, or a
|
||||
read-only loop device, in the case of a writable __rootfs.img__, or an OverlayFS
|
||||
mount will use the persistent overlay directory linked at `/run/overlayfs‑r` as
|
||||
an additional lower layer along with the base root filesystem and apply a
|
||||
transient, writable upper directory overlay, in order to complete the booted
|
||||
root filesystem.
|
||||
|
||||
**rd.live.overlay.reset=**1::
|
||||
Specifies that a persistent overlay should be reset on boot. All root
|
||||
Specifies that a persistent overlay should be reset on boot. All previous root
|
||||
filesystem changes are vacated by this action.
|
||||
|
||||
**rd.live.overlay.thin=**1::
|
||||
@@ -992,25 +1025,25 @@ that memory is given back to the kernel when the filesystem does not claim it
|
||||
anymore.
|
||||
|
||||
**rd.live.overlay.overlayfs=**1::
|
||||
Enables the use of the **OverlayFS** kernel module, if available, to provide a
|
||||
Enables the use of the *OverlayFS* kernel module, if available, to provide a
|
||||
copy-on-write union directory for the root filesystem. OverlayFS overlays are
|
||||
directories of the files that have changed on the read-only base (lower)
|
||||
filesystem. The root filesystem is provided through a special overlay type
|
||||
mount that merges the lower and upper directories. If an OverlayFS upper
|
||||
directory is not present on the boot device, a tmpfs directory will be created
|
||||
at /run/overlayfs to provide temporary storage. Persistent storage can be
|
||||
at `/run/overlayfs` to provide temporary storage. Persistent storage can be
|
||||
provided on vfat or msdos formatted devices by supplying the OverlayFS upper
|
||||
directory within an embedded filesystem that supports the creation of trusted.*
|
||||
extended attributes and provides a valid d_type in readdir responses, such as
|
||||
with ext4 and xfs. On non-vfat-formatted devices, a persistent OverlayFS
|
||||
overlay can extend the available root filesystem storage up to the capacity of
|
||||
the LiveOS device.
|
||||
|
||||
the LiveOS disk device.
|
||||
+
|
||||
If a persistent overlay is detected at the standard LiveOS path, the overlay &
|
||||
overlay type detected (whether OverlayFS or Device-mapper) will be used.
|
||||
|
||||
overlay type detected, whether OverlayFS or Device-mapper, will be used.
|
||||
+
|
||||
The **rd.live.overlay.readonly** option, which allows a persistent overlayfs to
|
||||
be mounted read only through a higher level transient overlay directory, has
|
||||
be mounted read-only through a higher level transient overlay directory, has
|
||||
been implemented through the multiple lower layers feature of OverlayFS.
|
||||
|
||||
|
||||
|
@@ -212,7 +212,7 @@ check() should return with:
|
||||
|
||||
0:: Include the dracut module in the initramfs.
|
||||
|
||||
1:: Do not include the dracut module. The requirements are not fullfilled
|
||||
1:: Do not include the dracut module. The requirements are not fulfilled
|
||||
(missing tools, etc.)
|
||||
|
||||
255:: Only include the dracut module, if another module requires it or if
|
||||
@@ -255,8 +255,8 @@ not lead to an error.
|
||||
==== inst <src> [<dst>]
|
||||
|
||||
installs _one_ file <src> either to the same place in the initramfs or to an
|
||||
optional <dst>. inst with more than two arguments is treated the same as
|
||||
inst_multiple, all arguments are treated as files to install and none as
|
||||
optional <dst>. inst with more than two arguments is treated the same as
|
||||
inst_multiple, all arguments are treated as files to install and none as
|
||||
install destinations.
|
||||
|
||||
==== inst_hook <hookdir> <prio> <src>
|
||||
|
120
dracut.sh
120
dracut.sh
@@ -474,9 +474,6 @@ if [[ $append_args_l == "yes" ]]; then
|
||||
eval set -- "$TEMP"
|
||||
rearrange_params "$@"
|
||||
fi
|
||||
|
||||
# clean the temporarily used scratch-pad directory
|
||||
rm -rf $scratch_dir
|
||||
fi
|
||||
|
||||
unset PARMS_TO_STORE
|
||||
@@ -1492,6 +1489,9 @@ dinfo "*** Including modules done ***"
|
||||
|
||||
## final stuff that has to happen
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
if [[ $hostonly ]]; then
|
||||
echo "$(get_loaded_kernel_modules)" > $initdir/lib/dracut/loaded-kernel-modules.txt
|
||||
fi
|
||||
|
||||
if [[ $drivers ]]; then
|
||||
hostonly='' instmods $drivers
|
||||
@@ -1747,6 +1747,120 @@ fi
|
||||
|
||||
dinfo "*** Creating image file '$outfile' ***"
|
||||
|
||||
if dracut_module_included "squash"; then
|
||||
if ! check_kernel_config CONFIG_SQUASHFS; then
|
||||
dfatal "CONFIG_SQUASHFS have to be enabled for dracut squash module to work"
|
||||
exit 1
|
||||
fi
|
||||
if ! check_kernel_config CONFIG_OVERLAY_FS; then
|
||||
dfatal "CONFIG_OVERLAY_FS have to be enabled for dracut squash module to work"
|
||||
exit 1
|
||||
fi
|
||||
if ! check_kernel_config CONFIG_DEVTMPFS; then
|
||||
dfatal "CONFIG_DEVTMPFS have to be enabled for dracut squash module to work"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readonly squash_dir="${DRACUT_TMPDIR}/squashfs"
|
||||
readonly squash_img=$initdir/squash/root.img
|
||||
|
||||
# Currently only move "usr" "etc" to squashdir
|
||||
readonly squash_candidate=( "usr" "etc" )
|
||||
|
||||
mkdir -m 0755 -p $squash_dir
|
||||
for folder in "${squash_candidate[@]}"; do
|
||||
mv $initdir/$folder $squash_dir/$folder
|
||||
done
|
||||
|
||||
# Reinstall required files, because we have moved some important folders to $squash_dir
|
||||
inst_multiple "echo" "sh" "mount" "modprobe" "mkdir" \
|
||||
"systemctl" "udevadm" "$systemdutildir/systemd"
|
||||
hostonly="" instmods "loop" "squashfs" "overlay"
|
||||
|
||||
for folder in "${squash_candidate[@]}"; do
|
||||
# Remove duplicated files in squashfs image, save some more space
|
||||
[[ ! -d $initdir/$folder/ ]] && continue
|
||||
for file in $(find $initdir/$folder/ -not -type d);
|
||||
do
|
||||
if [[ -e $squash_dir${file#$initdir} ]]; then
|
||||
mv $squash_dir${file#$initdir} $file
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# Move some files out side of the squash image, including:
|
||||
# - Files required to boot and mount the squashfs image
|
||||
# - Files need to be accessable without mounting the squash image
|
||||
required_in_root() {
|
||||
local file=$1
|
||||
local _sqsh_file=$squash_dir/$file
|
||||
local _init_file=$initdir/$file
|
||||
|
||||
if [[ -e $_init_file ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ ! -e $_sqsh_file ]] && [[ ! -L $_sqsh_file ]]; then
|
||||
derror "$file is required to boot a squashed initramfs but it's not installed!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ ! -d $(dirname $_init_file) ]]; then
|
||||
required_in_root $(dirname $file)
|
||||
fi
|
||||
|
||||
if [[ -d $_sqsh_file ]]; then
|
||||
if [[ -L $_sqsh_file ]]; then
|
||||
cp --preserve=all -P $_sqsh_file $_init_file
|
||||
else
|
||||
mkdir $_init_file
|
||||
fi
|
||||
else
|
||||
if [[ -L $_sqsh_file ]]; then
|
||||
cp --preserve=all -P $_sqsh_file $_init_file
|
||||
_sqsh_file=$(realpath $_sqsh_file 2>/dev/null)
|
||||
if [[ -e $_sqsh_file ]] && [[ "$_sqsh_file" == "$squash_dir"* ]]; then
|
||||
# Relative symlink
|
||||
required_in_root ${_sqsh_file#$squash_dir/}
|
||||
return
|
||||
fi
|
||||
if [[ -e $squash_dir$_sqsh_file ]]; then
|
||||
# Absolute symlink
|
||||
required_in_root ${_sqsh_file#/}
|
||||
return
|
||||
fi
|
||||
required_in_root ${module_spec#$squash_dir/}
|
||||
else
|
||||
mv $_sqsh_file $_init_file
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
required_in_root etc/initrd-release
|
||||
|
||||
for module_spec in $squash_dir/usr/lib/modules/*/modules.*;
|
||||
do
|
||||
required_in_root ${module_spec#$squash_dir/}
|
||||
done
|
||||
|
||||
for dracut_spec in $squash_dir/usr/lib/dracut/*;
|
||||
do
|
||||
required_in_root ${dracut_spec#$squash_dir/}
|
||||
done
|
||||
|
||||
mv $initdir/init $initdir/init.stock
|
||||
mv $initdir/shutdown $initdir/shutdown.stock
|
||||
ln -s squash/init.sh $initdir/init
|
||||
ln -s squash/shutdown.sh $initdir/shutdown
|
||||
|
||||
mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null
|
||||
|
||||
if [[ $? != 0 ]]; then
|
||||
dfatal "dracut: Failed making squash image"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $uefi = yes ]]; then
|
||||
readonly uefi_outdir="$DRACUT_TMPDIR/uefi"
|
||||
mkdir "$uefi_outdir"
|
||||
|
45
dracut.spec
45
dracut.spec
@@ -49,7 +49,7 @@ BuildRequires: docbook-style-xsl docbook-dtds libxslt
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
-BuildRequires: docbook-xsl-stylesheets libxslt
|
||||
BuildRequires: docbook-xsl-stylesheets libxslt
|
||||
%endif
|
||||
|
||||
BuildRequires: asciidoc
|
||||
@@ -178,6 +178,16 @@ Requires: %{name} = %{version}-%{release}
|
||||
%description tools
|
||||
This package contains tools to assemble the local initrd and host configuration.
|
||||
|
||||
%package squash
|
||||
Summary: dracut module to build an initramfs with most files in a squashfs image
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: squash-tools
|
||||
|
||||
%description squash
|
||||
This package provides a dracut module to build an initramfs, but store most files
|
||||
in a squashfs image, result in a smaller initramfs size and reduce runtime memory
|
||||
usage.
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{version} -S git_am
|
||||
cp %{SOURCE1} .
|
||||
@@ -235,6 +245,8 @@ rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95qeth_rules
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95zfcp
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95zfcp_rules
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95znet
|
||||
%else
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00warpclock
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/boot/dracut
|
||||
@@ -259,10 +271,13 @@ rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
|
||||
echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
|
||||
|
||||
# FIXME: remove after F30
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
|
||||
install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
%endif
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,0755)
|
||||
%if %{with doc}
|
||||
%doc README HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
%endif
|
||||
@@ -313,6 +328,12 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
||||
%endif
|
||||
%{dracutlibdir}/modules.d/00bash
|
||||
%{dracutlibdir}/modules.d/00systemd
|
||||
%ifnarch s390 s390x
|
||||
%{dracutlibdir}/modules.d/00warpclock
|
||||
%endif
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
%{dracutlibdir}/modules.d/01fips
|
||||
%endif
|
||||
%{dracutlibdir}/modules.d/01systemd-initrd
|
||||
%{dracutlibdir}/modules.d/03modsign
|
||||
%{dracutlibdir}/modules.d/03rescue
|
||||
@@ -329,6 +350,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
||||
%{dracutlibdir}/modules.d/90dm
|
||||
%{dracutlibdir}/modules.d/90dmraid
|
||||
%{dracutlibdir}/modules.d/90kernel-modules
|
||||
%{dracutlibdir}/modules.d/90kernel-modules-extra
|
||||
%{dracutlibdir}/modules.d/90lvm
|
||||
%{dracutlibdir}/modules.d/90mdraid
|
||||
%{dracutlibdir}/modules.d/90multipath
|
||||
@@ -396,14 +418,10 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
||||
%{_prefix}/lib/kernel/install.d/50-dracut.install
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/01fips
|
||||
%endif
|
||||
|
||||
%files network
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/02systemd-networkd
|
||||
%{dracutlibdir}/modules.d/35network-manager
|
||||
%{dracutlibdir}/modules.d/35network-legacy
|
||||
%{dracutlibdir}/modules.d/40network
|
||||
%{dracutlibdir}/modules.d/45ifcfg
|
||||
%{dracutlibdir}/modules.d/90kernel-network-modules
|
||||
@@ -421,37 +439,36 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
|
||||
%{dracutlibdir}/modules.d/99uefi-lib
|
||||
|
||||
%files caps
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/02caps
|
||||
|
||||
%files live
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/99img-lib
|
||||
%{dracutlibdir}/modules.d/90dmsquash-live
|
||||
%{dracutlibdir}/modules.d/90dmsquash-live-ntfs
|
||||
%{dracutlibdir}/modules.d/90livenet
|
||||
|
||||
%files tools
|
||||
%defattr(-,root,root,0755)
|
||||
|
||||
%if %{with doc}
|
||||
%doc %{_mandir}/man8/dracut-catimages.8*
|
||||
%endif
|
||||
|
||||
%files squash
|
||||
%{dracutlibdir}/modules.d/99squash
|
||||
|
||||
%{_bindir}/dracut-catimages
|
||||
%dir /boot/dracut
|
||||
%dir /var/lib/dracut
|
||||
%dir /var/lib/dracut/overlay
|
||||
|
||||
%files config-generic
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
|
||||
|
||||
%files config-rescue
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/dracut.conf.d/02-rescue.conf
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
# FIXME: remove after F30
|
||||
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
|
@@ -243,7 +243,7 @@ If your root partition is on a network drive, you have to have the network
|
||||
dracut modules installed to create a network aware initramfs image.
|
||||
|
||||
If you specify ip=dhcp on the kernel command line, then dracut asks a dhcp
|
||||
server about the ip adress for the machine. The dhcp server can also serve an
|
||||
server about the ip address for the machine. The dhcp server can also serve an
|
||||
additional root-path, which will set the root device for dracut. With this
|
||||
mechanism, you have static configuration on your client machine and a
|
||||
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
|
||||
@@ -252,7 +252,7 @@ method described in <<Injecting>>.
|
||||
|
||||
==== Reducing the Image Size
|
||||
|
||||
To reduce the size of the initramfs, you should create it with by ommitting all
|
||||
To reduce the size of the initramfs, you should create it with by omitting all
|
||||
dracut modules, which you know, you don't need to boot the machine.
|
||||
|
||||
You can also specify the exact dracut and kernel modules to produce a very tiny
|
||||
|
61
fedora-test.sh
Executable file
61
fedora-test.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
[[ -d ${0%/*} ]] && cd ${0%/*}
|
||||
|
||||
RUN_ID="$1"
|
||||
TESTS=$2
|
||||
|
||||
dnf -y update --best --allowerasing &>/dev/null
|
||||
|
||||
dnf -y install --best --allowerasing \
|
||||
dash \
|
||||
asciidoc \
|
||||
mdadm \
|
||||
lvm2 \
|
||||
dmraid \
|
||||
cryptsetup \
|
||||
nfs-utils \
|
||||
nbd \
|
||||
dhcp-server \
|
||||
scsi-target-utils \
|
||||
iscsi-initiator-utils \
|
||||
strace \
|
||||
btrfs-progs \
|
||||
kmod-devel \
|
||||
gcc \
|
||||
bzip2 \
|
||||
xz \
|
||||
tar \
|
||||
wget \
|
||||
rpm-build \
|
||||
make \
|
||||
git \
|
||||
bash-completion \
|
||||
sudo \
|
||||
kernel \
|
||||
dhcp-client \
|
||||
/usr/bin/qemu-kvm \
|
||||
/usr/bin/qemu-system-$(uname -i) \
|
||||
e2fsprogs \
|
||||
$NULL &>/dev/null
|
||||
|
||||
./configure
|
||||
|
||||
NCPU=$(getconf _NPROCESSORS_ONLN)
|
||||
|
||||
if ! [[ $TESTS ]]; then
|
||||
make -j$NCPU all syncheck rpm logtee
|
||||
else
|
||||
make -j$NCPU all logtee
|
||||
|
||||
cd test
|
||||
|
||||
time sudo make \
|
||||
KVERSION=$(rpm -qa kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -rn | head -1) \
|
||||
TEST_RUN_ID=$RUN_ID \
|
||||
${TESTS:+TESTS="$TESTS"} \
|
||||
-k V=2 \
|
||||
check
|
||||
fi
|
@@ -1244,7 +1244,7 @@ static int install_dependent_modules(struct kmod_list *modlist)
|
||||
path = kmod_module_get_path(mod);
|
||||
|
||||
name = kmod_module_get_name(mod);
|
||||
if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) {
|
||||
if ((path == NULL) || (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0))) {
|
||||
kmod_module_unref(mod);
|
||||
continue;
|
||||
}
|
||||
|
@@ -167,7 +167,7 @@ int safe_atoi(const char *s, int *ret_i);
|
||||
int safe_atollu(const char *s, unsigned long long *ret_u);
|
||||
int safe_atolli(const char *s, long long int *ret_i);
|
||||
|
||||
#if __WORDSIZE == 32
|
||||
#if LONG_MAX == INT_MAX
|
||||
static inline int safe_atolu(const char *s, unsigned long *ret_u) {
|
||||
assert_cc(sizeof(unsigned long) == sizeof(unsigned));
|
||||
return safe_atou(s, (unsigned*) ret_u);
|
||||
|
54
logtee.c
Normal file
54
logtee.c
Normal file
@@ -0,0 +1,54 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define BUFLEN 4096
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int fd;
|
||||
int len, slen;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s <file>\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if (fd == -1) {
|
||||
perror("open");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Logging to %s: ", argv[1]);
|
||||
|
||||
slen = 0;
|
||||
|
||||
do {
|
||||
len = splice(STDIN_FILENO, NULL, fd, NULL,
|
||||
BUFLEN, SPLICE_F_MOVE);
|
||||
|
||||
if (len < 0) {
|
||||
if (errno == EAGAIN)
|
||||
continue;
|
||||
perror("tee");
|
||||
exit(EXIT_FAILURE);
|
||||
} else
|
||||
if (len == 0)
|
||||
break;
|
||||
slen += len;
|
||||
if ((slen/BUFLEN) > 0) {
|
||||
fprintf(stderr, ".");
|
||||
}
|
||||
slen = slen % BUFLEN;
|
||||
|
||||
} while (1);
|
||||
close(fd);
|
||||
fprintf(stderr, "\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
@@ -34,11 +34,17 @@ OPTIONS
|
||||
**-k, --kver** _<kernel version>_::
|
||||
inspect the initramfs of <kernel version>.
|
||||
|
||||
**-m, --mod**::
|
||||
list dracut modules included of the initramfs image.
|
||||
|
||||
**--unpack**::
|
||||
unpack the initramfs to the current directory, instead of displaying the contents.
|
||||
If optional filenames are given, will only unpack specified files, else the whole image will be unpacked.
|
||||
Won't unpack anything from early cpio part.
|
||||
|
||||
**--unpackearly**::
|
||||
unpack the early microcode initramfs to the current directory, instead of displaying the contents.
|
||||
Same as --unpack, but only unpack files from early cpio part.
|
||||
|
||||
**-v, --verbose**::
|
||||
unpack verbosely
|
||||
|
30
lsinitrd.sh
30
lsinitrd.sh
@@ -28,7 +28,10 @@ usage()
|
||||
echo "-m, --mod list modules."
|
||||
echo "-f, --file <filename> print the contents of <filename>."
|
||||
echo "--unpack unpack the initramfs, instead of displaying the contents."
|
||||
echo " If optional filenames are given, will only unpack specified files,"
|
||||
echo " else the whole image will be unpacked. Won't unpack anything from early cpio part."
|
||||
echo "--unpackearly unpack the early microcode part of the initramfs."
|
||||
echo " Same as --unpack, but only unpack files from early cpio part."
|
||||
echo "-v, --verbose unpack verbosely."
|
||||
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
|
||||
echo
|
||||
@@ -159,8 +162,15 @@ list_files()
|
||||
|
||||
unpack_files()
|
||||
{
|
||||
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose
|
||||
((ret+=$?))
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
for f in "${!filenames[@]}"; do
|
||||
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose $f
|
||||
((ret+=$?))
|
||||
done
|
||||
else
|
||||
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose
|
||||
((ret+=$?))
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +185,10 @@ case $bin in
|
||||
CAT="cat --"
|
||||
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
|
||||
if [[ "$is_early" ]]; then
|
||||
if [[ -n "$unpackearly" ]]; then
|
||||
if [[ -n "$unpack" ]]; then
|
||||
# should use --unpackearly for early CPIO
|
||||
:
|
||||
elif [[ -n "$unpackearly" ]]; then
|
||||
unpack_files
|
||||
elif (( ${#filenames[@]} > 0 )); then
|
||||
extract_files
|
||||
@@ -241,6 +254,17 @@ if [[ $SKIP ]]; then
|
||||
CAT=skipcpio
|
||||
fi
|
||||
|
||||
if (( ${#filenames[@]} > 1 )); then
|
||||
TMPFILE="$(mktemp -t --suffix=.cpio lsinitrd.XXXXXX)"
|
||||
$CAT "$image" 2>/dev/null > $TMPFILE
|
||||
trap "rm -f '$TMPFILE'" EXIT
|
||||
pre_decompress()
|
||||
{
|
||||
cat $TMPFILE
|
||||
}
|
||||
CAT=pre_decompress
|
||||
fi
|
||||
|
||||
ret=0
|
||||
|
||||
if [[ -n "$unpack" ]]; then
|
||||
|
@@ -18,7 +18,7 @@ DESCRIPTION
|
||||
version <kernel-version> by calling *dracut*.
|
||||
|
||||
[IMPORTANT]
|
||||
This version of mkinitrd is provided for compability with older
|
||||
This version of mkinitrd is provided for compatibility with older
|
||||
versions of mkinitrd. If a more fine grained control over the
|
||||
resulting image is needed, *dracut* should be called directly.
|
||||
|
||||
@@ -30,7 +30,7 @@ OPTIONS
|
||||
**-k** _<kernel_list>_::
|
||||
List of kernel images for which initrd files are created (relative
|
||||
to _boot_dir_), Image name should begin with the following string,
|
||||
defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x and _vmlinuz_
|
||||
defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x and _vmlinuz_
|
||||
for everything else.
|
||||
|
||||
**-i** _<initrd_list>_::
|
||||
@@ -51,7 +51,7 @@ OPTIONS
|
||||
|
||||
**-d** _<root_device>_::
|
||||
Root device, defaults to the device from which the root_dir is
|
||||
mounted; overwrites the rootdev enviroment variable if set
|
||||
mounted; overwrites the rootdev environment variable if set
|
||||
|
||||
**-s** _<size>_::
|
||||
Add splash animation and bootscreen to initrd.
|
||||
|
29
modules.d/00warpclock/module-setup.sh
Normal file
29
modules.d/00warpclock/module-setup.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
# hwclock does not exist on S390(x), bail out silently then
|
||||
local _arch=$(uname -m)
|
||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] && return 1
|
||||
|
||||
[ -e /etc/localtime -a -e /etc/adjtime ] || return 1
|
||||
require_binaries /sbin/hwclock || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst /usr/share/zoneinfo/UTC
|
||||
inst /etc/localtime
|
||||
inst /etc/adjtime
|
||||
inst_hook pre-trigger 00 "$moddir/warpclock.sh"
|
||||
inst /sbin/hwclock
|
||||
}
|
9
modules.d/00warpclock/warpclock.sh
Normal file
9
modules.d/00warpclock/warpclock.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
if test -e /etc/adjtime ; then
|
||||
while read line ; do
|
||||
if test "$line" = LOCAL ; then
|
||||
hwclock --systz
|
||||
fi
|
||||
done < /etc/adjtime
|
||||
fi
|
@@ -38,13 +38,12 @@ install() {
|
||||
|
||||
ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"
|
||||
|
||||
local VERSION=""
|
||||
local PRETTY_NAME=""
|
||||
if [ -e /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
VERSION+=" "
|
||||
PRETTY_NAME+=" "
|
||||
else
|
||||
VERSION=""
|
||||
PRETTY_NAME=""
|
||||
[[ -n ${VERSION} ]] && VERSION+=" "
|
||||
[[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
|
||||
fi
|
||||
NAME=dracut
|
||||
ID=dracut
|
||||
|
@@ -41,6 +41,12 @@ do_dhcp() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -e /run/NetworkManager/conf.d/10-dracut-dhclient.conf ]; then
|
||||
mkdir -p /run/NetworkManager/conf.d
|
||||
echo '[main]' > /run/NetworkManager/conf.d/10-dracut-dhclient.conf
|
||||
echo 'dhcp=dhclient' >>/run/NetworkManager/conf.d/10-dracut-dhclient.conf
|
||||
fi
|
||||
|
||||
while [ $_COUNT -lt $_DHCPRETRY ]; do
|
||||
info "Starting dhcp for interface $netif"
|
||||
dhclient "$@" \
|
93
modules.d/35network-legacy/module-setup.sh
Executable file
93
modules.d/35network-legacy/module-setup.sh
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _program
|
||||
|
||||
require_binaries ip dhclient sed awk grep || return 1
|
||||
require_any_binary arping arping2 || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _arch _i _dir
|
||||
inst_multiple ip dhclient sed awk grep
|
||||
|
||||
inst_multiple -o arping arping2
|
||||
strstr "$(arping 2>&1)" "ARPing 2" && mv "$initdir/bin/arping" "$initdir/bin/arping2"
|
||||
|
||||
inst_multiple -o ping ping6
|
||||
inst_multiple -o teamd teamdctl teamnl
|
||||
inst_simple /etc/libnl/classid
|
||||
inst_script "$moddir/ifup.sh" "/sbin/ifup"
|
||||
inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst_simple -H "/etc/dhclient.conf"
|
||||
cat "$moddir/dhclient.conf" >> "${initdir}/etc/dhclient.conf"
|
||||
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
inst_hook cmdline 92 "$moddir/parse-ibft.sh"
|
||||
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-bond.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-team.sh"
|
||||
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
|
||||
inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
|
||||
|
||||
# install all config files for teaming
|
||||
unset TEAM_MASTER
|
||||
unset TEAM_CONFIG
|
||||
unset TEAM_PORT_CONFIG
|
||||
unset HWADDR
|
||||
unset SUBCHANNELS
|
||||
for i in /etc/sysconfig/network-scripts/ifcfg-*; do
|
||||
[ -e "$i" ] || continue
|
||||
case "$i" in
|
||||
*~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
(
|
||||
. "$i"
|
||||
if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
|
||||
&& [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
|
||||
if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
|
||||
mkdir -p $initdir/etc/teamd
|
||||
printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
|
||||
elif [ -n "$TEAM_PORT_CONFIG" ]; then
|
||||
inst_simple "$i"
|
||||
|
||||
HWADDR="$(echo $HWADDR | sed 'y/ABCDEF/abcdef/')"
|
||||
if [ -n "$HWADDR" ]; then
|
||||
ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
|
||||
fi
|
||||
|
||||
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
||||
if [ -n "$SUBCHANNELS" ]; then
|
||||
ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
)
|
||||
done
|
||||
|
||||
_arch=$(uname -m)
|
||||
|
||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
|
||||
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
52
modules.d/35network-manager/module-setup.sh
Executable file
52
modules.d/35network-manager/module-setup.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _program
|
||||
|
||||
require_binaries sed grep || return 1
|
||||
|
||||
# do not add this module by default
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _nm_version
|
||||
|
||||
_nm_version=$(NetworkManager --version)
|
||||
|
||||
inst_multiple sed grep
|
||||
|
||||
inst NetworkManager
|
||||
inst /usr/libexec/nm-initrd-generator
|
||||
inst_multiple -o teamd dhclient
|
||||
inst_hook cmdline 99 "$moddir/nm-config.sh"
|
||||
inst_hook initqueue/settled 99 "$moddir/nm-run.sh"
|
||||
inst_rules 85-nm-unmanaged.rules
|
||||
inst_libdir_file "NetworkManager/$_nm_version/libnm-device-plugin-team.so"
|
||||
|
||||
if [[ -x "$initdir/usr/sbin/dhclient" ]]; then
|
||||
inst /usr/libexec/nm-dhcp-helper
|
||||
elif ! [[ -e "$initdir/etc/machine-id" ]]; then
|
||||
# The internal DHCP client silently fails if we
|
||||
# have no machine-id
|
||||
systemd-machine-id-setup --root="$initdir"
|
||||
fi
|
||||
|
||||
# We don't install the ifcfg files from the host automatically.
|
||||
# But if the user chooses to include them, we pull in the machinery to read them.
|
||||
if ! [[ -d "$initdir/etc/sysconfig/network-scripts" ]]; then
|
||||
inst_libdir_file "NetworkManager/$_nm_version/libnm-settings-plugin-ifcfg-rh.so"
|
||||
fi
|
||||
}
|
3
modules.d/35network-manager/nm-config.sh
Executable file
3
modules.d/35network-manager/nm-config.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
/usr/libexec/nm-initrd-generator -- $(getcmdline)
|
16
modules.d/35network-manager/nm-run.sh
Executable file
16
modules.d/35network-manager/nm-run.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
|
||||
/usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace
|
||||
else
|
||||
/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
|
||||
fi
|
||||
|
||||
for _i in /sys/class/net/*/
|
||||
do
|
||||
state=/run/NetworkManager/devices/$(cat $_i/ifindex)
|
||||
grep -q managed=true $state 2>/dev/null || continue
|
||||
ifname=$(basename $_i)
|
||||
sed -n 's/root-path/new_root_path/p' <$state >/tmp/dhclient.$ifname.dhcpopts
|
||||
/sbin/netroot $ifname
|
||||
done
|
@@ -1,18 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _program
|
||||
|
||||
require_binaries ip dhclient sed awk grep || return 1
|
||||
require_any_binary arping arping2 || return 1
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo "kernel-network-modules"
|
||||
echo -n "kernel-network-modules "
|
||||
if ! dracut_module_included "network-legacy" && [ -x "/usr/libexec/nm-initrd-generator" ] ; then
|
||||
echo "network-manager"
|
||||
else
|
||||
echo "network-legacy"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -24,74 +19,10 @@ installkernel() {
|
||||
# called by dracut
|
||||
install() {
|
||||
local _arch _i _dir
|
||||
inst_multiple ip dhclient sed awk grep
|
||||
|
||||
inst_multiple -o arping arping2
|
||||
strstr "$(arping 2>&1)" "ARPing 2" && mv "$initdir/bin/arping" "$initdir/bin/arping2"
|
||||
|
||||
inst_multiple -o ping ping6
|
||||
inst_multiple -o teamd teamdctl teamnl
|
||||
inst_simple /etc/libnl/classid
|
||||
inst_script "$moddir/ifup.sh" "/sbin/ifup"
|
||||
inst_script "$moddir/netroot.sh" "/sbin/netroot"
|
||||
inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst_simple "$moddir/net-lib.sh" "/lib/net-lib.sh"
|
||||
inst_simple -H "/etc/dhclient.conf"
|
||||
cat "$moddir/dhclient.conf" >> "${initdir}/etc/dhclient.conf"
|
||||
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
|
||||
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
inst_hook cmdline 92 "$moddir/parse-ibft.sh"
|
||||
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-bond.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-team.sh"
|
||||
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
|
||||
inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
|
||||
|
||||
# install all config files for teaming
|
||||
unset TEAM_MASTER
|
||||
unset TEAM_CONFIG
|
||||
unset TEAM_PORT_CONFIG
|
||||
unset HWADDR
|
||||
unset SUBCHANNELS
|
||||
for i in /etc/sysconfig/network-scripts/ifcfg-*; do
|
||||
[ -e "$i" ] || continue
|
||||
case "$i" in
|
||||
*~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
(
|
||||
. "$i"
|
||||
if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
|
||||
&& [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
|
||||
if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
|
||||
mkdir -p $initdir/etc/teamd
|
||||
printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
|
||||
elif [ -n "$TEAM_PORT_CONFIG" ]; then
|
||||
inst_simple "$i"
|
||||
|
||||
HWADDR="$(echo $HWADDR | sed 'y/ABCDEF/abcdef/')"
|
||||
if [ -n "$HWADDR" ]; then
|
||||
ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
|
||||
fi
|
||||
|
||||
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
||||
if [ -n "$SUBCHANNELS" ]; then
|
||||
ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
)
|
||||
done
|
||||
|
||||
_arch=$(uname -m)
|
||||
|
||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
|
||||
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,7 @@ if [ -z "$2" ]; then
|
||||
# we die. Otherwise we just warn
|
||||
if [ -z "$new_root_path" ] ; then
|
||||
[ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
|
||||
warn "No dhcp root-path received for '$BOOTDEV' trying other interfaces if available"
|
||||
warn "No dhcp root-path received for '$netif' trying other interfaces if available"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@@ -14,6 +14,7 @@ depends() {
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_binary sort
|
||||
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
|
||||
}
|
||||
|
||||
|
@@ -286,7 +286,10 @@ echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab
|
||||
echo "files /var/lib/dhclient" >> /run/initramfs/rwtab
|
||||
{
|
||||
cp /tmp/net.* /run/initramfs/
|
||||
cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/resolv.conf
|
||||
for i in /tmp/net.*.resolv.conf; do
|
||||
[ -f "$i" ] && cat "$i"
|
||||
done | sort -u > /run/initramfs/state/etc/resolv.conf
|
||||
[ -s /run/initramfs/state/etc/resolv.conf ] || rm -f /run/initramfs/state/etc/resolv.conf
|
||||
copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
|
||||
cp /tmp/ifcfg-leases/* /run/initramfs/state/var/lib/dhclient
|
||||
} > /dev/null 2>&1
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -L /run/rootfsbase ] && [ -d /run/initramfs/live/updates -o -d /updates ]; then
|
||||
if [ -h /dev/root ] && [ -d /run/initramfs/live/updates -o -d /updates ]; then
|
||||
info "Applying updates to live image..."
|
||||
mount -o bind /run $NEWROOT/run
|
||||
# avoid overwriting symlinks (e.g. /lib -> /usr/lib) with directories
|
||||
|
@@ -18,12 +18,12 @@ fi
|
||||
case "$liveroot" in
|
||||
live:LABEL=*|LABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="${root//\//\\x2f}"
|
||||
root="live:/dev/disk/by-label/${root#LABEL=}"
|
||||
rootok=1 ;;
|
||||
live:CDLABEL=*|CDLABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="${root//\//\\x2f}"
|
||||
root="live:/dev/disk/by-label/${root#CDLABEL=}"
|
||||
rootok=1 ;;
|
||||
live:UUID=*|UUID=*) \
|
||||
@@ -54,8 +54,10 @@ GENERATOR_DIR="$2"
|
||||
[ -z "$GENERATOR_DIR" ] && exit 1
|
||||
[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
|
||||
|
||||
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
|
||||
[ -e /xor_overlayfs ] && xor_overlayfs="yes"
|
||||
[ -e /xor_readonly ] && xor_readonly="--readonly"
|
||||
ROOTFLAGS="$(getarg rootflags)"
|
||||
{
|
||||
echo "[Unit]"
|
||||
@@ -64,7 +66,12 @@ ROOTFLAGS="$(getarg rootflags)"
|
||||
echo "Where=/sysroot"
|
||||
if [ "$overlayfs$xor_overlayfs" = "yes" ]; then
|
||||
echo "What=LiveOS_rootfs"
|
||||
echo "Options=${ROOTFLAGS},lowerdir=/run/rootfsbase,upperdir=/run/overlayfs,workdir=/run/ovlwork"
|
||||
if [ "$readonly_overlay$xor_readonly" = "--readonly" ]; then
|
||||
ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
|
||||
else
|
||||
ovlfs=lowerdir=/run/rootfsbase
|
||||
fi
|
||||
echo "Options=${ROOTFLAGS},${ovlfs},upperdir=/run/overlayfs,workdir=/run/ovlwork"
|
||||
echo "Type=overlay"
|
||||
_dev=LiveOS_rootfs
|
||||
else
|
||||
|
@@ -109,15 +109,15 @@ do_live_overlay() {
|
||||
|
||||
if [ -z "$overlay" ]; then
|
||||
pathspec="/${live_dir}/overlay-$l-$u"
|
||||
elif ( echo $overlay | grep -q ":" ); then
|
||||
elif strstr $overlay ":"; then
|
||||
# pathspec specified, extract
|
||||
pathspec=$( echo $overlay | sed -e 's/^.*://' )
|
||||
pathspec=${overlay##*:}
|
||||
fi
|
||||
|
||||
if [ -z "$pathspec" -o "$pathspec" = "auto" ]; then
|
||||
pathspec="/${live_dir}/overlay-$l-$u"
|
||||
fi
|
||||
devspec=$( echo $overlay | sed -e 's/:.*$//' )
|
||||
devspec=${overlay%%:*}
|
||||
|
||||
# need to know where to look for the overlay
|
||||
if [ -z "$setup" -a -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
|
||||
@@ -137,7 +137,7 @@ do_live_overlay() {
|
||||
fi
|
||||
if [ -n "$overlayfs" ]; then
|
||||
unset -v overlayfs
|
||||
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="yes"
|
||||
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit=":>/xor_overlayfs;"
|
||||
fi
|
||||
setup="yes"
|
||||
else
|
||||
@@ -146,10 +146,10 @@ do_live_overlay() {
|
||||
[ -d /run/initramfs/overlayfs/ovlwork ]; then
|
||||
ln -s /run/initramfs/overlayfs/overlayfs /run/overlayfs$opt
|
||||
ln -s /run/initramfs/overlayfs/ovlwork /run/ovlwork$opt
|
||||
if [ -z "$overlayfs" ]; then
|
||||
overlayfs="yes"
|
||||
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="yes"
|
||||
if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
reloadsysrootmountunit=":>/xor_overlayfs;"
|
||||
fi
|
||||
overlayfs="required"
|
||||
setup="yes"
|
||||
fi
|
||||
fi
|
||||
@@ -157,19 +157,24 @@ do_live_overlay() {
|
||||
[ -d /run/initramfs/overlayfs$pathspec/../ovlwork ]; then
|
||||
ln -s /run/initramfs/overlayfs$pathspec /run/overlayfs$opt
|
||||
ln -s /run/initramfs/overlayfs$pathspec/../ovlwork /run/ovlwork$opt
|
||||
if [ -z "$overlayfs" ]; then
|
||||
overlayfs="yes"
|
||||
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="yes"
|
||||
if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
reloadsysrootmountunit=":>/xor_overlayfs;"
|
||||
fi
|
||||
overlayfs="required"
|
||||
setup="yes"
|
||||
fi
|
||||
fi
|
||||
if [ -n "$overlayfs" ]; then
|
||||
modprobe overlay
|
||||
if [ $? != 0 ]; then
|
||||
if [ "$overlayfs" = required ]; then
|
||||
die "OverlayFS is required but not available."
|
||||
exit 1
|
||||
fi
|
||||
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit=":>/xor_overlayfs;"
|
||||
m='OverlayFS is not available; using temporary Device-mapper overlay.'
|
||||
info $m
|
||||
unset -v overlayfs setup
|
||||
[ -n "$reloadsysrootmountunit" ] && unset -v reloadsysrootmountunit
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -181,7 +186,7 @@ do_live_overlay() {
|
||||
m=' Unable to find a persistent overlay; using a temporary one.'
|
||||
m="$m"$'\n All root filesystem changes will be lost on shutdown.'
|
||||
m="$m"$'\n Press [Enter] to continue.'
|
||||
echo -e "\n\n\n\n${m}\n\n\n" > /dev/kmsg
|
||||
printf "\n\n\n\n${m}\n\n\n" > /dev/kmsg
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
if type plymouth >/dev/null 2>&1 && plymouth --ping ; then
|
||||
if getargbool 0 rhgb || getargbool 0 splash ; then
|
||||
@@ -203,6 +208,11 @@ do_live_overlay() {
|
||||
if [ -n "$overlayfs" ]; then
|
||||
mkdir -m 0755 /run/overlayfs
|
||||
mkdir -m 0755 /run/ovlwork
|
||||
if [ -n "$readonly_overlay" ] && ! [ -h /run/overlayfs-r ]; then
|
||||
info "No persistent overlay found."
|
||||
unset -v readonly_overlay
|
||||
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="${reloadsysrootmountunit}:>/xor_readonly;"
|
||||
fi
|
||||
else
|
||||
dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((overlay_size*1024)) 2> /dev/null
|
||||
if [ -n "$setup" -a -n "$readonly_overlay" ]; then
|
||||
@@ -250,14 +260,13 @@ do_live_overlay() {
|
||||
echo 0 $sz snapshot $base $over PO 8 | dmsetup create live-rw
|
||||
fi
|
||||
|
||||
# Create a device that always points to a ro base image
|
||||
if [ -n "$overlayfs" ]; then
|
||||
BASE_LOOPDUP=$(losetup -f --show -r $BASE_LOOPDEV)
|
||||
echo 0 $sz linear $BASE_LOOPDUP 0 | dmsetup create --readonly live-base
|
||||
else
|
||||
# Create a device for the ro base of overlayed file systems.
|
||||
if [ -z "$overlayfs" ]; then
|
||||
echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base
|
||||
fi
|
||||
ln -s $BASE_LOOPDEV /dev/live-base
|
||||
}
|
||||
# end do_live_overlay()
|
||||
|
||||
# we might have a genMinInstDelta delta file for anaconda to take advantage of
|
||||
if [ -e /run/initramfs/live/${live_dir}/osmin.img ]; then
|
||||
@@ -291,10 +300,21 @@ if [ -e "$SQUASHED" ]; then
|
||||
mkdir -m 0755 -p /run/initramfs/squashfs
|
||||
mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /run/initramfs/squashfs
|
||||
|
||||
if [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
|
||||
FSIMG="/run/initramfs/squashfs/LiveOS/rootfs.img"
|
||||
elif [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
|
||||
FSIMG="/run/initramfs/squashfs/LiveOS/ext3fs.img"
|
||||
if [ -d /run/initramfs/squashfs/LiveOS ]; then
|
||||
if [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
|
||||
FSIMG="/run/initramfs/squashfs/LiveOS/rootfs.img"
|
||||
elif [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
|
||||
FSIMG="/run/initramfs/squashfs/LiveOS/ext3fs.img"
|
||||
fi
|
||||
elif [ -d /run/initramfs/squashfs/proc ]; then
|
||||
FSIMG=$SQUASHED
|
||||
if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
reloadsysrootmountunit=":>/xor_overlayfs;"
|
||||
fi
|
||||
overlayfs="required"
|
||||
else
|
||||
die "Failed to find a root filesystem in $SQUASHED."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# we might have an embedded fs image to use as rootfs (uncompressed live)
|
||||
@@ -312,8 +332,8 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$FSIMG" ] ; then
|
||||
if [ -n "$writable_fsimg" ] ; then
|
||||
if [ -n "$FSIMG" ]; then
|
||||
if [ -n "$writable_fsimg" ]; then
|
||||
# mount the provided filesystem read/write
|
||||
echo "Unpacking live filesystem (may take some time)" > /dev/kmsg
|
||||
mkdir -m 0755 /run/initramfs/fsimg/
|
||||
@@ -336,9 +356,13 @@ if [ -n "$FSIMG" ] ; then
|
||||
setup=yes
|
||||
fi
|
||||
fi
|
||||
BASE_LOOPDEV=$(losetup -f --show $opt $FSIMG)
|
||||
sz=$(blockdev --getsz $BASE_LOOPDEV)
|
||||
if [ "$setup" == rw ]; then
|
||||
if [ "$FSIMG" = "$SQUASHED" ]; then
|
||||
BASE_LOOPDEV=$SQUASHED_LOOPDEV
|
||||
else
|
||||
BASE_LOOPDEV=$(losetup -f --show $opt $FSIMG)
|
||||
sz=$(blockdev --getsz $BASE_LOOPDEV)
|
||||
fi
|
||||
if [ "$setup" = rw ]; then
|
||||
echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create live-rw
|
||||
else
|
||||
# Add a DM snapshot or OverlayFS for writes.
|
||||
@@ -346,8 +370,6 @@ if [ -n "$FSIMG" ] ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -e "$SQUASHED" ] && [ -z "$overlayfs" ] && umount -l /run/initramfs/squashfs
|
||||
|
||||
if [ -b "$OSMIN_LOOPDEV" ]; then
|
||||
# set up the devicemapper snapshot device, which will merge
|
||||
# the normal live fs image, and the delta, into a minimzied fs image
|
||||
@@ -355,7 +377,7 @@ if [ -b "$OSMIN_LOOPDEV" ]; then
|
||||
fi
|
||||
|
||||
if [ -n "$reloadsysrootmountunit" ]; then
|
||||
> /xor_overlayfs
|
||||
eval "$reloadsysrootmountunit"
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
|
||||
@@ -363,33 +385,33 @@ ROOTFLAGS="$(getarg rootflags)"
|
||||
|
||||
if [ -n "$overlayfs" ]; then
|
||||
mkdir -m 0755 /run/rootfsbase
|
||||
if [ -n "$reset_overlay" ] && [ -L /run/overlayfs ]; then
|
||||
if [ -n "$reset_overlay" ] && [ -h /run/overlayfs ]; then
|
||||
ovlfs=$(readlink /run/overlayfs)
|
||||
info "Resetting the OverlayFS overlay directory."
|
||||
rm -r -- ${ovlfs}/* ${ovlfs}/.* >/dev/null 2>&1
|
||||
fi
|
||||
if [ -n "$readonly_overlay" ]; then
|
||||
mkdir -m 0755 /run/rootfsbase-r
|
||||
mount -r $FSIMG /run/rootfsbase-r
|
||||
mount -t overlay LiveOS_rootfs-r -oro,lowerdir=/run/overlayfs-r:/run/rootfsbase-r /run/rootfsbase
|
||||
if [ -n "$readonly_overlay" ] && [ -h /run/overlayfs-r ]; then
|
||||
ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
|
||||
else
|
||||
mount -r $FSIMG /run/rootfsbase
|
||||
ovlfs=lowerdir=/run/rootfsbase
|
||||
fi
|
||||
mount -r $FSIMG /run/rootfsbase
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
#FIXME What to link to /dev/root? Is it even needed?
|
||||
printf 'mount -t overlay LiveOS_rootfs -o%s,%s %s\n' "$ROOTFLAGS" \
|
||||
'lowerdir=/run/rootfsbase,upperdir=/run/overlayfs,workdir=/run/ovlwork' \
|
||||
"$ovlfs",upperdir=/run/overlayfs,workdir=/run/ovlwork \
|
||||
"$NEWROOT" > $hookdir/mount/01-$$-live.sh
|
||||
fi
|
||||
else
|
||||
ln -s /dev/mapper/live-rw /dev/root
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
[ -n "$ROOTFLAGS" ] && ROOTFLAGS="-o $ROOTFLAGS"
|
||||
printf 'mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh
|
||||
fi
|
||||
ln -s $BASE_LOOPDEV /run/rootfsbase
|
||||
fi
|
||||
[ -e "$SQUASHED" ] && umount -l /run/initramfs/squashfs
|
||||
|
||||
ln -s null /dev/root
|
||||
|
||||
need_shutdown
|
||||
|
||||
exit 0
|
||||
|
||||
|
@@ -22,7 +22,7 @@ installkernel() {
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple umount dmsetup blkid dd losetup grep blockdev find
|
||||
inst_multiple umount dmsetup blkid dd losetup blockdev find
|
||||
inst_multiple -o checkisomd5
|
||||
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
|
||||
inst_hook cmdline 31 "$moddir/parse-iso-scan.sh"
|
||||
|
@@ -20,12 +20,12 @@ modprobe -q loop
|
||||
case "$liveroot" in
|
||||
live:LABEL=*|LABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="${root//\//\\x2f}"
|
||||
root="live:/dev/disk/by-label/${root#LABEL=}"
|
||||
rootok=1 ;;
|
||||
live:CDLABEL=*|CDLABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="${root//\//\\x2f}"
|
||||
root="live:/dev/disk/by-label/${root#CDLABEL=}"
|
||||
rootok=1 ;;
|
||||
live:UUID=*|UUID=*) \
|
||||
@@ -57,6 +57,6 @@ info "root was $liveroot, is now $root"
|
||||
# make sure that init doesn't complain
|
||||
[ -z "$root" ] && root="live"
|
||||
|
||||
wait_for_dev -n /run/rootfsbase
|
||||
wait_for_dev -n /dev/root
|
||||
|
||||
return 0
|
||||
|
194
modules.d/90kernel-modules-extra/module-setup.sh
Executable file
194
modules.d/90kernel-modules-extra/module-setup.sh
Executable file
@@ -0,0 +1,194 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
#
|
||||
# Parses depmod configuration and calls instmods for out-of-tree kernel
|
||||
# modules found. Specifically, kernel modules inside directories that
|
||||
# come from the following places are included (if these kernel modules
|
||||
# are present in modules.dep):
|
||||
# - "search" configuration option;
|
||||
# - "override" configuration option (matching an exact file name constructed
|
||||
# by concatenating the provided directory and the kernel module name);
|
||||
# - "external" configuration option (if "external" is a part of "search"
|
||||
# configuration).
|
||||
# (See depmod.d(5) for details.)
|
||||
#
|
||||
# This module has the following variables available for configuration:
|
||||
# - "depmod_modules_dep" - Path to the modules.dep file
|
||||
# ("$srcmods/modules.dep" by default);
|
||||
# - "depmod_module_dir" - Directory containing kernel modules ("$srcmods"
|
||||
# by default);
|
||||
# - "depmod_configs" - array of depmod configuration paths to parse
|
||||
# (as supplied to depmod -C, ("/run/depmod.d/"
|
||||
# "/etc/depmod.d/" "/lib/depmod.d/") by default).
|
||||
installkernel()
|
||||
{
|
||||
: "${depmod_modules_dep:=$srcmods/modules.dep}"
|
||||
: "${depmod_module_dir:=$srcmods}"
|
||||
|
||||
[[ -f "${depmod_modules_dep}" ]] || return 0
|
||||
|
||||
# Message printers with custom prefix
|
||||
local mod_name="kernel-modules-extra"
|
||||
prinfo() { dinfo " ${mod_name}: $*"; }
|
||||
prdebug() { ddebug " ${mod_name}: $*"; }
|
||||
|
||||
# Escape a string for usage as a part of extended regular expression.
|
||||
# $1 - string to escape
|
||||
re_escape() {
|
||||
printf "%s" "$1" | sed 's/\([.+?^$\/\\|()\[]\|\]\)/\\\0/'
|
||||
}
|
||||
|
||||
local OLDIFS
|
||||
local cfg
|
||||
local cfgs=()
|
||||
local search_list=""
|
||||
local overrides=()
|
||||
local external_dirs=()
|
||||
local e f
|
||||
|
||||
|
||||
## Gathering and sorting configuration file list
|
||||
|
||||
[ -n "${depmod_configs[@]-}" ] \
|
||||
|| depmod_configs=(/run/depmod.d/ /etc/depmod.d/ /lib/depmod.d/)
|
||||
|
||||
for cfg in "${depmod_configs[@]}"; do
|
||||
[ -e "$cfg" ] || {
|
||||
prdebug "configuration source \"$cfg\" does not exist"
|
||||
continue
|
||||
}
|
||||
|
||||
# '/' is used as a separator between configuration name and
|
||||
# configuration path
|
||||
if [ -d "$cfg" ]; then
|
||||
for f in "$cfg/"*; do
|
||||
[[ -e "$f" && ! -d "$f" ]] || {
|
||||
prdebug "configuration source" \
|
||||
"\"$cfg\" is ignored" \
|
||||
"(directory or doesn't exist)"
|
||||
continue
|
||||
}
|
||||
cfgs+=("$(basename "$f")/$f")
|
||||
done
|
||||
else
|
||||
cfgs+=("$(basename "$cfg")/$cfg")
|
||||
fi
|
||||
done
|
||||
|
||||
OLDIFS="$IFS"
|
||||
IFS=$'\n'
|
||||
LANG=C cfgs=($(printf '%s\n' "${cfgs[@]}" \
|
||||
| sort -u -k1,1 -t '/' | cut -f 2- -d '/'))
|
||||
IFS="$OLDIFS"
|
||||
|
||||
|
||||
## Parse configurations
|
||||
|
||||
for cfg in "${cfgs[@]}"; do
|
||||
prdebug "parsing configuration file \"$cfg\""
|
||||
|
||||
local k v mod kverpat path
|
||||
while read -r k v; do
|
||||
case "$k" in
|
||||
search)
|
||||
search_list="$search_list $v"
|
||||
prdebug "$cfg: added \"$v\" to the list of" \
|
||||
"search directories"
|
||||
;;
|
||||
override) # module_name kver_pattern dir
|
||||
read -r mod kverpat path <<<"$v"
|
||||
|
||||
if [[ ! "$mod" || ! "$kverpat" || ! "$path" ]]
|
||||
then
|
||||
prinfo "$cfg: ignoring incorrect" \
|
||||
"override option: \"$k $v\""
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ '*' = "$kverpat" \
|
||||
|| "$kernel" =~ "$kverpat" ]]
|
||||
then
|
||||
overrides+=("${path}/${mod}")
|
||||
|
||||
prdebug "$cfg: added override" \
|
||||
"\"${path}/${mod}\""
|
||||
else
|
||||
prdebug "$cfg: override \"$v\" is" \
|
||||
"ignored since \"$kverpat\"" \
|
||||
"doesn't match \"$kernel\""
|
||||
fi
|
||||
;;
|
||||
external) # kverpat dir
|
||||
read -r kverpat path <<<"$v"
|
||||
|
||||
if [[ ! "$kverpat" || ! "$path" ]]; then
|
||||
prinfo "$cfg: ignoring incorrect" \
|
||||
"external option: \"$k $v\""
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ '*' = "$kverpat" \
|
||||
|| "$kernel" =~ "$kverpat" ]]
|
||||
then
|
||||
external_dirs+=("$path")
|
||||
|
||||
prdebug "$cfg: added external" \
|
||||
"directory \"$path\""
|
||||
else
|
||||
prdebug "$cfg: external directory" \
|
||||
"\"$path\" is ignored since" \
|
||||
"\"$kverpat\" doesn't match " \
|
||||
"\"$kernel\""
|
||||
fi
|
||||
;;
|
||||
'#'*|'') # comments and empty strings
|
||||
;;
|
||||
include|make_map_files) # ignored by depmod
|
||||
;;
|
||||
*)
|
||||
prinfo "$cfg: unknown depmod configuration" \
|
||||
"option \"$k $v\""
|
||||
;;
|
||||
esac
|
||||
done < "$cfg"
|
||||
done
|
||||
|
||||
# "updates built-in" is the default search list
|
||||
: "${search_list:=updates}"
|
||||
|
||||
|
||||
## Build a list of regular expressions for grepping modules.dep
|
||||
|
||||
local pathlist=()
|
||||
for f in "${overrides[@]}"; do
|
||||
pathlist+=("^$(re_escape "$f")")
|
||||
done
|
||||
|
||||
for f in $(printf "%s" "$search_list"); do
|
||||
# Ignoring builtin modules
|
||||
[ "built-in" != "$f" ] || continue
|
||||
|
||||
if [ "external" = "$f" ]; then
|
||||
for e in "${external_dirs[@]}"; do
|
||||
pathlist+=("$(re_escape "${e%/}")/[^:]+")
|
||||
done
|
||||
fi
|
||||
|
||||
pathlist+=("$(re_escape "${f%/}")/[^:]+")
|
||||
done
|
||||
|
||||
|
||||
## Filter modules.dep, canonicalise the resulting filenames and supply
|
||||
## them to instmods.
|
||||
|
||||
[ 0 -lt "${#pathlist[@]}" ] || return 0
|
||||
|
||||
printf "^%s\.ko(\.gz|\.bz2|\.xz)?:\n" "${pathlist[@]}" \
|
||||
| (LANG=C grep -E -o -f - -- "$depmod_modules_dep" || exit 0) \
|
||||
| tr -d ':' \
|
||||
| (cd "$depmod_module_dir" || exit; xargs -r realpath -e --) \
|
||||
| instmods || return 1
|
||||
|
||||
return 0
|
||||
}
|
@@ -25,7 +25,7 @@ installkernel() {
|
||||
ohci-hcd ohci-pci \
|
||||
uhci-hcd \
|
||||
xhci-hcd xhci-pci xhci-plat-hcd \
|
||||
pinctrl-cherryview \
|
||||
"=drivers/pinctrl" \
|
||||
${NULL}
|
||||
|
||||
hostonly=$(optional_hostonly) instmods \
|
||||
@@ -41,7 +41,7 @@ installkernel() {
|
||||
yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
|
||||
atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \
|
||||
virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
|
||||
"=drivers/pcmcia" =ide nvme vmd
|
||||
"=drivers/pcmcia" =ide nvme vmd nfit
|
||||
|
||||
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
|
||||
# arm/aarch64 specific modules
|
||||
@@ -50,6 +50,7 @@ installkernel() {
|
||||
"=drivers/clk" \
|
||||
"=drivers/dma" \
|
||||
"=drivers/extcon" \
|
||||
"=drivers/gpio" \
|
||||
"=drivers/hwspinlock" \
|
||||
"=drivers/i2c/busses" \
|
||||
"=drivers/mfd" \
|
||||
|
@@ -28,7 +28,7 @@ installkernel() {
|
||||
=drivers/net/phy \
|
||||
=drivers/net/team \
|
||||
=drivers/net/ethernet \
|
||||
ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net xennet
|
||||
ecb arc4 bridge stp llc ipv6 bonding 8021q ipvlan macvlan af_packet virtio_net xennet
|
||||
hostonly="" instmods iscsi_ibft crc32c iscsi_boot_sysfs
|
||||
}
|
||||
|
||||
|
@@ -43,19 +43,36 @@ GENERATOR_DIR="$2"
|
||||
|
||||
[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
|
||||
|
||||
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
|
||||
[ -e /xor_overlayfs ] && xor_overlayfs="yes"
|
||||
[ -e /xor_readonly ] && xor_readonly="--readonly"
|
||||
ROOTFLAGS="$(getarg rootflags)"
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "Before=initrd-root-fs.target"
|
||||
echo "[Mount]"
|
||||
echo "Where=/sysroot"
|
||||
echo "What=/dev/mapper/live-rw"
|
||||
[ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
|
||||
if [ "$overlayfs$xor_overlayfs" = "yes" ]; then
|
||||
echo "What=LiveOS_rootfs"
|
||||
if [ "$readonly_overlay$xor_readonly" = "--readonly" ]; then
|
||||
ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
|
||||
else
|
||||
ovlfs=lowerdir=/run/rootfsbase
|
||||
fi
|
||||
echo "Options=${ROOTFLAGS},${ovlfs},upperdir=/run/overlayfs,workdir=/run/ovlwork"
|
||||
echo "Type=overlay"
|
||||
_dev=LiveOS_rootfs
|
||||
else
|
||||
echo "What=/dev/mapper/live-rw"
|
||||
[ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
|
||||
_dev=$'dev-mapper-live\\x2drw'
|
||||
fi
|
||||
} > "$GENERATOR_DIR"/sysroot.mount
|
||||
|
||||
mkdir -p "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d"
|
||||
mkdir -p "$GENERATOR_DIR/$_dev.device.d"
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "JobTimeoutSec=3000"
|
||||
echo "JobRunningTimeoutSec=3000"
|
||||
} > "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d/timeout.conf"
|
||||
} > "$GENERATOR_DIR/$_dev.device.d/timeout.conf"
|
||||
|
@@ -39,6 +39,9 @@ _md_force_run() {
|
||||
_offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
|
||||
|
||||
if [ -n "$_MD_UUID" ]; then
|
||||
_MD_UUID=$(str_replace "$_MD_UUID" "-" "")
|
||||
_MD_UUID=$(str_replace "$_MD_UUID" ":" "")
|
||||
|
||||
for _md in /dev/md[0-9_]*; do
|
||||
[ -b "$_md" ] || continue
|
||||
_UUID=$(
|
||||
@@ -50,6 +53,7 @@ _md_force_run() {
|
||||
)
|
||||
|
||||
[ -z "$_UUID" ] && continue
|
||||
_UUID=$(str_replace "$_UUID" ":" "")
|
||||
|
||||
# check if we should handle this device
|
||||
strstr " $_MD_UUID " " $_UUID " || continue
|
||||
|
@@ -1,6 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
|
||||
# normalize the uuid
|
||||
MD_UUID=$(str_replace "$MD_UUID" "-" "")
|
||||
MD_UUID=$(str_replace "$MD_UUID" ":" "")
|
||||
|
||||
if ( ! [ -n "$MD_UUID" ] && ! getargbool 0 rd.auto ) || ! getargbool 1 rd.md -d -n rd_NO_MD; then
|
||||
info "rd.md=0: removing MD RAID activation"
|
||||
@@ -12,10 +15,12 @@ else
|
||||
[ -e "$f" ] || continue
|
||||
while read line || [ -n "$line" ]; do
|
||||
if [ "${line%%UUID CHECK}" != "$line" ]; then
|
||||
for uuid in $MD_UUID; do
|
||||
printf 'ENV{ID_FS_UUID}=="%s", GOTO="md_uuid_ok"\n' "$(expr substr $uuid 1 8)-$(expr substr $uuid 9 4)-$(expr substr $uuid 13 4)-$(expr substr $uuid 17 4)-$(expr substr $uuid 21 12)"
|
||||
done;
|
||||
printf 'IMPORT{program}="/sbin/mdadm --examine --export $tempnode"\n'
|
||||
for uuid in $MD_UUID; do
|
||||
printf 'ENV{MD_UUID}=="%s", GOTO="md_uuid_ok"\n' $uuid
|
||||
printf 'ENV{ID_FS_UUID}=="%s", GOTO="md_uuid_ok"\n' $uuid
|
||||
printf 'ENV{MD_UUID}=="%s", GOTO="md_uuid_ok"\n' "$(expr substr $uuid 1 8):$(expr substr $uuid 9 8):$(expr substr $uuid 17 8):$(expr substr $uuid 25 8)"
|
||||
done;
|
||||
printf 'GOTO="md_end"\n'
|
||||
printf 'LABEL="md_uuid_ok"\n'
|
||||
@@ -26,11 +31,7 @@ else
|
||||
mv "${f}.new" "$f"
|
||||
done
|
||||
for uuid in $MD_UUID; do
|
||||
if strstr "$uuid" "-"; then
|
||||
# convert ID_FS_UUID to MD_UUID format
|
||||
uuid=$(str_replace "$uuid" "-" "")
|
||||
uuid="$(expr substr $uuid 1 8):$(expr substr $uuid 9 8):$(expr substr $uuid 17 8):$(expr substr $uuid 25 8)"
|
||||
fi
|
||||
uuid="$(expr substr $uuid 1 8):$(expr substr $uuid 9 8):$(expr substr $uuid 17 8):$(expr substr $uuid 25 8)"
|
||||
wait_for_dev "/dev/disk/by-id/md-uuid-${uuid}"
|
||||
done
|
||||
fi
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
for i in $(multipath -l -v1); do
|
||||
if ! $(dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1') ; then
|
||||
if ! dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1' ; then
|
||||
dmsetup message $i 0 fail_if_no_path
|
||||
fi
|
||||
done
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
require_binaries stratisd-init thin_check thin_repair || return 1
|
||||
require_binaries stratisd-init thin_check thin_repair mkfs.xfs xfs_admin xfs_growfs || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ installkernel() {
|
||||
# called by dracut
|
||||
install() {
|
||||
|
||||
inst_multiple stratisd-init thin_check thin_repair
|
||||
inst_multiple stratisd-init thin_check thin_repair mkfs.xfs xfs_admin xfs_growfs
|
||||
|
||||
if dracut_module_included "systemd"; then
|
||||
inst_simple "${moddir}/stratisd-init.service" "${systemdsystemunitdir}/stratisd-init.service"
|
||||
|
0
modules.d/95fcoe/cleanup-fcoe.sh
Normal file → Executable file
0
modules.d/95fcoe/cleanup-fcoe.sh
Normal file → Executable file
@@ -109,7 +109,7 @@ handle_netroot()
|
||||
arg=$(getarg rd.iscsi.in.password -d iscsi_in_password=)
|
||||
[ -n "$arg" ] && iscsi_in_password=$arg
|
||||
for p in $(getargs rd.iscsi.param -d iscsi_param); do
|
||||
iscsi_param="$iscsi_param $p"
|
||||
iscsi_param="$iscsi_param $p"
|
||||
done
|
||||
|
||||
parse_iscsi_root "$1" || return 1
|
||||
@@ -194,6 +194,12 @@ handle_netroot()
|
||||
sleep 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
iscsid
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
# FIXME $iscsi_protocol??
|
||||
|
||||
if [ "$root" = "dhcp" ] || [ "$netroot" = "dhcp" ]; then
|
||||
@@ -208,28 +214,31 @@ handle_netroot()
|
||||
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
|
||||
fi
|
||||
|
||||
### ToDo: Upstream calls systemd-run - Shall we, do we have to port this?
|
||||
|
||||
targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/')
|
||||
[ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1
|
||||
|
||||
for target in $iscsi_target_name; do
|
||||
case "$targets" in
|
||||
*$target*)
|
||||
EXTRA=""
|
||||
if [ -n "$iscsi_iface_name" ]; then
|
||||
$(iscsiadm -m iface -I $iscsi_iface_name --op=new)
|
||||
[ -n "$iscsi_initiator" ] && $(iscsiadm -m iface -I $iscsi_iface_name --op=update --name=iface.initiatorname --value=$iscsi_initiator)
|
||||
[ -n "$iscsi_netdev_name" ] && $(iscsiadm -m iface -I $iscsi_iface_name --op=update --name=iface.net_ifacename --value=$iscsi_netdev_name)
|
||||
COMMAND="iscsiadm -m node -T $target -p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} -I $iscsi_iface_name --op=update"
|
||||
else
|
||||
COMMAND="iscsiadm -m node -T $target -p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} --op=update"
|
||||
iscsiadm -m iface -I $iscsi_iface_name --op=new
|
||||
EXTRA=" ${iscsi_netdev_name:+--name=iface.net_ifacename --value=$iscsi_netdev_name} "
|
||||
EXTRA="$EXTRA ${iscsi_initiator:+--name=iface.initiatorname --value=$iscsi_initiator} "
|
||||
fi
|
||||
$($COMMAND --name=node.startup --value=onboot)
|
||||
[ -n "$iscsi_username" ] && $($COMMAND --name=node.session.auth.username --value=$iscsi_username)
|
||||
[ -n "$iscsi_password" ] && $($COMMAND --name=node.session.auth.password --value=$iscsi_password)
|
||||
[ -n "$iscsi_in_username" ] && $($COMMAND --name=node.session.auth.username_in --value=$iscsi_in_username)
|
||||
[ -n "$iscsi_in_password" ] && $($COMMAND --name=node.session.auth.password_in --value=$iscsi_in_password)
|
||||
[ -n "$iscsi_param" ] && for param in $iscsi_param; do $($COMMAND --name=${param%=*} --value=${param#*=}); done
|
||||
[ -n "$iscsi_param" ] && for param in $iscsi_param; do EXTRA="$EXTRA --name=${param%=*} --value=${param#*=}"; done
|
||||
|
||||
iscsiadm -m node -T $target \
|
||||
${iscsi_iface_name:+-I $iscsi_iface_name} \
|
||||
-p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} \
|
||||
--op=update \
|
||||
--name=node.startup --value=onboot \
|
||||
${iscsi_username:+ --name=node.session.auth.username --value=$iscsi_username} \
|
||||
${iscsi_password:+ --name=node.session.auth.password --value=$iscsi_password} \
|
||||
${iscsi_in_username:+--name=node.session.auth.username_in --value=$iscsi_in_username} \
|
||||
${iscsi_in_password:+--name=node.session.auth.password_in --value=$iscsi_in_password} \
|
||||
$EXTRA \
|
||||
$NULL
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
|
@@ -208,9 +208,6 @@ install() {
|
||||
inst_libdir_file 'libgcc_s.so*'
|
||||
inst_multiple umount hostname iscsi-iname iscsiadm iscsid
|
||||
|
||||
ln -sf $systemdsystemunitdir/iscsid.socket $systemdsystemunitdir/sockets.target.wants/iscsid.socket
|
||||
ln -sf $systemdsystemunitdir/iscsiuio.socket $systemdsystemunitdir/sockets.target.wants/iscsiuio.socket
|
||||
|
||||
inst_multiple -o \
|
||||
$systemdsystemunitdir/iscsid.socket \
|
||||
$systemdsystemunitdir/iscsid.service \
|
||||
@@ -219,7 +216,11 @@ install() {
|
||||
$systemdsystemunitdir/sockets.target.wants/iscsid.socket \
|
||||
$systemdsystemunitdir/sockets.target.wants/iscsiuio.socket
|
||||
|
||||
[[ -d /etc/iscsi ]] && inst_dir $(/usr/bin/find /etc/iscsi)
|
||||
if [[ $hostonly ]]; then
|
||||
inst_dir $(/usr/bin/find /etc/iscsi)
|
||||
else
|
||||
inst_simple /etc/iscsi/iscsid.conf
|
||||
fi
|
||||
|
||||
# Detect iBFT and perform mandatory steps
|
||||
if [[ $hostonly_cmdline == "yes" ]] ; then
|
||||
@@ -243,6 +244,7 @@ install() {
|
||||
|
||||
mkdir -p "${initdir}/$systemdsystemunitdir/sockets.target.wants"
|
||||
for i in \
|
||||
iscsid.socket \
|
||||
iscsiuio.socket \
|
||||
; do
|
||||
ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/sockets.target.wants/${i}"
|
||||
|
@@ -90,19 +90,13 @@ if [ -n "$iscsi_firmware" ]; then
|
||||
initqueue --unique --onetime --settled /sbin/iscsiroot online "iscsi:" "'$NEWROOT'"
|
||||
fi
|
||||
|
||||
if [ -z "$netroot" ] || ! [ "${netroot%%:*}" = "iscsi" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
|
||||
|
||||
initqueue --onetime modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi qedi
|
||||
|
||||
# ISCSI actually supported?
|
||||
if ! [ -e /sys/module/iscsi_tcp ]; then
|
||||
modprobe -b -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
|
||||
fi
|
||||
|
||||
modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi
|
||||
|
||||
if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
|
||||
if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
|
||||
initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
|
||||
@@ -141,6 +135,11 @@ if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ]
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$netroot" ] || ! [ "${netroot%%:*}" = "iscsi" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
|
||||
|
||||
for nroot in $(getargs netroot); do
|
||||
[ "${nroot%%:*}" = "iscsi" ] || continue
|
||||
|
@@ -7,6 +7,8 @@ Description=dracut ask for additional cmdline parameters
|
||||
DefaultDependencies=no
|
||||
Before=dracut-cmdline.service
|
||||
After=systemd-journald.socket
|
||||
After=systemd-vconsole-setup.service
|
||||
Requires=systemd-vconsole-setup.service
|
||||
Wants=systemd-journald.socket
|
||||
ConditionPathExists=/usr/lib/initrd-release
|
||||
ConditionKernelCommandLine=|rd.cmdline=ask
|
||||
|
@@ -1060,7 +1060,7 @@ if ! command -v pidof >/dev/null 2>/dev/null; then
|
||||
debug_on
|
||||
return 1
|
||||
fi
|
||||
_exe=$(type -P "$1")
|
||||
_exe=$(command -v "$1")
|
||||
for i in /proc/*/exe; do
|
||||
[ -e "$i" ] || continue
|
||||
if [ -n "$_exe" ]; then
|
||||
|
@@ -63,13 +63,12 @@ install() {
|
||||
echo ro >> "${initdir}/etc/cmdline.d/base.conf"
|
||||
fi
|
||||
|
||||
local VERSION=""
|
||||
local PRETTY_NAME=""
|
||||
if [ -e /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
VERSION+=" "
|
||||
PRETTY_NAME+=" "
|
||||
else
|
||||
VERSION=""
|
||||
PRETTY_NAME=""
|
||||
[[ -n ${VERSION} ]] && VERSION+=" "
|
||||
[[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
|
||||
fi
|
||||
NAME=dracut
|
||||
ID=dracut
|
||||
@@ -94,6 +93,9 @@ install() {
|
||||
|
||||
## save host_devs which we need bring up
|
||||
if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
if [[ -n $add_device ]]; then
|
||||
dracut_need_initqueue
|
||||
fi
|
||||
if [[ -f "$initdir/lib/dracut/need-initqueue" ]] || ! dracut_module_included "systemd"; then
|
||||
(
|
||||
if dracut_module_included "systemd"; then
|
||||
|
9
modules.d/99squash/clear-squash.sh
Executable file
9
modules.d/99squash/clear-squash.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
SQUASH_MNT_REC=/squash/mounts
|
||||
SQUASH_MNTS=( )
|
||||
|
||||
while read mnt; do
|
||||
SQUASH_MNTS+=( "$mnt" )
|
||||
done <<< "$(cat $SQUASH_MNT_REC)"
|
||||
|
||||
umount --lazy -- ${SQUASH_MNTS[@]}
|
7
modules.d/99squash/init.sh
Executable file
7
modules.d/99squash/init.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
/squash/setup-squash.sh
|
||||
|
||||
exec /init.stock
|
||||
|
||||
echo "Something went wrong when trying to start original init executable!"
|
||||
exit 1
|
29
modules.d/99squash/module-setup.sh
Normal file
29
modules.d/99squash/module-setup.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo "bash systemd systemd-initrd"
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
hostonly="" instmods squashfs loop overlay
|
||||
}
|
||||
|
||||
install() {
|
||||
if ! type -P mksquashfs >/dev/null || ! type -P unsquashfs >/dev/null ; then
|
||||
derror "squash module requires squashfs-tools to be installed."
|
||||
return 1
|
||||
fi
|
||||
|
||||
inst_multiple kmod modprobe mount mkdir ln echo
|
||||
inst $moddir/setup-squash.sh /squash/setup-squash.sh
|
||||
inst $moddir/clear-squash.sh /squash/clear-squash.sh
|
||||
inst $moddir/init.sh /squash/init.sh
|
||||
|
||||
inst "$moddir/squash-mnt-clear.service" "$systemdsystemunitdir/squash-mnt-clear.service"
|
||||
ln_r "$systemdsystemunitdir/squash-mnt-clear.service" "$systemdsystemunitdir/initrd.target.wants/squash-mnt-clear.service"
|
||||
}
|
61
modules.d/99squash/setup-squash.sh
Executable file
61
modules.d/99squash/setup-squash.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
PATH=/bin:/sbin
|
||||
|
||||
SQUASH_IMG=/squash/root.img
|
||||
SQUASH_MNT=/squash/root
|
||||
SQUASH_MNT_REC=/squash/mounts
|
||||
SQUASHED_MNT="usr etc"
|
||||
|
||||
echo $SQUASH_MNT > $SQUASH_MNT_REC
|
||||
|
||||
# Following mount points are neccessary for mounting a squash image
|
||||
|
||||
[ ! -d /proc/self ] && \
|
||||
mount -t proc -o nosuid,noexec,nodev proc /proc
|
||||
|
||||
[ ! -d /sys/kernel ] && \
|
||||
mount -t sysfs -o nosuid,noexec,nodev sysfs /sys
|
||||
|
||||
[ ! -e /dev/loop-control ] && \
|
||||
mount -t devtmpfs -o mode=0755,noexec,nosuid,strictatime devtmpfs /dev
|
||||
|
||||
# Need a loop device backend, overlayfs, and squashfs module
|
||||
modprobe loop
|
||||
if [ $? != 0 ]; then
|
||||
echo "Unable to setup loop module"
|
||||
fi
|
||||
|
||||
modprobe squashfs
|
||||
if [ $? != 0 ]; then
|
||||
echo "Unable to setup squashfs module"
|
||||
fi
|
||||
|
||||
modprobe overlay
|
||||
if [ $? != 0 ]; then
|
||||
echo "Unable to setup overlay module"
|
||||
fi
|
||||
|
||||
[ ! -d "$SQUASH_MNT" ] && \
|
||||
mkdir -m 0755 -p $SQUASH_MNT
|
||||
|
||||
# Mount the squashfs image
|
||||
mount -t squashfs -o ro,loop $SQUASH_IMG $SQUASH_MNT
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
echo "Unable to mount squashed initramfs image"
|
||||
fi
|
||||
|
||||
for file in $SQUASHED_MNT; do
|
||||
lowerdir=$SQUASH_MNT/$file
|
||||
workdir=/squash/overlay-work/$file
|
||||
upperdir=/$file
|
||||
mntdir=/$file
|
||||
|
||||
mkdir -m 0755 -p $workdir
|
||||
mkdir -m 0755 -p $mntdir
|
||||
|
||||
mount -t overlay overlay -o\
|
||||
lowerdir=$lowerdir,upperdir=$upperdir,workdir=$workdir $mntdir
|
||||
|
||||
echo $mntdir >> $SQUASH_MNT_REC
|
||||
done
|
7
modules.d/99squash/shutdown.sh
Executable file
7
modules.d/99squash/shutdown.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
/squash/setup-squash.sh
|
||||
|
||||
exec /shutdown.stock
|
||||
|
||||
echo "Something went wrong when trying to start original shutdown executable!"
|
||||
exit 1
|
19
modules.d/99squash/squash-mnt-clear.service
Normal file
19
modules.d/99squash/squash-mnt-clear.service
Normal file
@@ -0,0 +1,19 @@
|
||||
# This file is part of dracut.
|
||||
#
|
||||
|
||||
[Unit]
|
||||
Description=Cleanup squashfs mounts when switch root
|
||||
DefaultDependencies=no
|
||||
After=initrd.target
|
||||
After=dracut-initqueue.service dracut-pre-pivot.service
|
||||
Before=initrd-cleanup.service
|
||||
ConditionPathExists=/squash/root
|
||||
Conflicts=initrd-switch-root.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
StandardInput=null
|
||||
StandardOutput=syslog+console
|
||||
StandardError=syslog+console
|
||||
ExecStop=/squash/clear-squash.sh
|
@@ -1,15 +1,16 @@
|
||||
.PHONY: all check clean
|
||||
.PHONY: all check clean $(wildcard TEST-??-*)
|
||||
|
||||
check:
|
||||
$(wildcard TEST-??-*):
|
||||
@[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; }
|
||||
@{ ret=0; \
|
||||
for i in TEST-[0-9]*; do \
|
||||
[ -d $$i ] || continue ; \
|
||||
[ -f $$i/Makefile ] || continue ; \
|
||||
if [ -n "$$TESTS" ]; then t=$${i##TEST-}; t=$${t%%-*}; [ "$${TESTS#*$$t*}" != "$$TESTS" ] || continue; fi; \
|
||||
if [ -n "$$SKIP" ]; then t=$${i##TEST-}; t=$${t%%-*}; [ "$${SKIP#*$$t*}" != "$$SKIP" ] && continue; fi; \
|
||||
$(MAKE) -C $$i all ; ret=$$((ret + $$?)); \
|
||||
done; exit $$ret; }
|
||||
@{ \
|
||||
[ -d $@ ] || exit 0; \
|
||||
[ -f $@/Makefile ] || exit 0; \
|
||||
if [ -n "$$TESTS" ]; then t=$${$@##TEST-}; t=$${t%%-*}; [ "$${TESTS#*$$t*}" != "$$TESTS" ] || exit 0; fi; \
|
||||
if [ -n "$$SKIP" ]; then t=$${$@##TEST-}; t=$${t%%-*}; [ "$${SKIP#*$$t*}" != "$$SKIP" ] && exit 0; fi; \
|
||||
$(MAKE) -C $@ all ; \
|
||||
}
|
||||
|
||||
check: $(wildcard TEST-??-*)
|
||||
|
||||
clean:
|
||||
@for i in TEST-[0-9]*; do \
|
||||
|
@@ -15,7 +15,7 @@ test_run() {
|
||||
-net none \
|
||||
-watchdog i6300esb -watchdog-action poweroff \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=LABEL=dracut rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.debug console=ttyS0,115200n81 rd.shell=0 $DEBUGFAIL rd.memdebug=4" \
|
||||
-append "panic=1 root=LABEL=dracut rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.debug console=ttyS0,115200n81 rd.shell=0 $DEBUGFAIL" \
|
||||
-initrd $TESTDIR/initramfs.testing || return 1
|
||||
grep -F -m 1 -q dracut-root-block-success $TESTDIR/result || return 1
|
||||
}
|
||||
@@ -46,8 +46,8 @@ test_setup() {
|
||||
[ -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 "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
inst_simple /etc/os-release
|
||||
inst ./test-init.sh /sbin/init
|
||||
|
@@ -43,8 +43,8 @@ test_setup() {
|
||||
[ -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 "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
inst_simple /etc/os-release
|
||||
inst ./test-init.sh /sbin/init
|
||||
|
@@ -73,8 +73,8 @@ test_setup() {
|
||||
[ -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 "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
inst_simple ./fstab /etc/fstab
|
||||
inst_simple /etc/os-release
|
||||
|
@@ -79,8 +79,8 @@ test_setup() {
|
||||
[ -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 "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
inst_simple ./fstab /etc/fstab
|
||||
rpm -ql systemd | xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} -o -a -l
|
||||
|
@@ -45,8 +45,8 @@ test_setup() {
|
||||
inst_multiple -o ${_terminfodir}/l/linux
|
||||
inst_simple /etc/os-release
|
||||
inst ./test-init.sh /sbin/init
|
||||
inst "$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
|
||||
inst "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
inst_multiple -o /lib/systemd/systemd-shutdown
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
|
@@ -41,8 +41,8 @@ test_setup() {
|
||||
[ -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 "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
inst_simple /etc/os-release
|
||||
inst ./test-init.sh /sbin/init
|
||||
|
@@ -82,8 +82,8 @@ test_setup() {
|
||||
[ -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 "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
inst_simple /etc/os-release
|
||||
inst ./test-init.sh /sbin/init
|
||||
|
@@ -81,8 +81,8 @@ test_setup() {
|
||||
[ -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 "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
inst_simple /etc/os-release
|
||||
inst ./test-init.sh /sbin/init
|
||||
|
@@ -76,8 +76,8 @@ test_setup() {
|
||||
done
|
||||
inst_multiple -o ${_terminfodir}/l/linux
|
||||
inst_simple /etc/os-release
|
||||
inst "$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
|
||||
inst "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
inst ./test-init.sh /sbin/init
|
||||
find_binary plymouth >/dev/null && inst_multiple plymouth
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#!/bin/sh
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
exec >/dev/console 2>&1
|
||||
echo "dracut-root-block-success" >/dev/sda1
|
||||
echo "dracut-root-block-success" >/dev/sda
|
||||
sync
|
||||
export TERM=linux
|
||||
export PS1='initramfs-test:\w\$ '
|
||||
[ -f /etc/fstab ] || ln -s /proc/mounts /etc/fstab
|
||||
|
@@ -7,14 +7,17 @@ KVERSION=${KVERSION-$(uname -r)}
|
||||
#DEBUGFAIL="rd.shell"
|
||||
test_run() {
|
||||
DISKIMAGE=$TESTDIR/TEST-15-BTRFSRAID-root.img
|
||||
MARKER_DISKIMAGE=$TESTDIR/TEST-15-BTRFSRAID-marker.img
|
||||
dd if=/dev/zero of=$MARKER_DISKIMAGE bs=512 count=10
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$DISKIMAGE \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-drive format=raw,index=0,media=disk,file=$MARKER_DISKIMAGE \
|
||||
-drive format=raw,index=1,media=disk,file=$DISKIMAGE \
|
||||
-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" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
dd if=$DISKIMAGE bs=512 count=4 skip=2048 | grep -F -m 1 -q dracut-root-block-success $DISKIMAGE || return 1
|
||||
grep -F -m 1 -q dracut-root-block-success $MARKER_DISKIMAGE || return 1
|
||||
}
|
||||
|
||||
test_setup() {
|
||||
@@ -38,13 +41,13 @@ test_setup() {
|
||||
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
|
||||
mount dmesg dhclient mkdir cp ping dhclient sync
|
||||
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 "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
inst ./test-init.sh /sbin/init
|
||||
inst_simple /etc/os-release
|
||||
|
@@ -78,8 +78,8 @@ test_setup() {
|
||||
[[ -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 "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep syslinux isohybrid
|
||||
for f in /usr/share/syslinux/*; do
|
||||
inst_simple "$f"
|
||||
|
@@ -41,8 +41,8 @@ test_setup() {
|
||||
[ -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 "$basedir/modules.d/35network-legacy/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
|
||||
inst_multiple grep
|
||||
inst_simple /etc/os-release
|
||||
inst ./test-init.sh /sbin/init
|
||||
|
@@ -76,6 +76,13 @@ do_test_run() {
|
||||
"rd.iscsi.initiator=$initiator" \
|
||||
|| return 1
|
||||
|
||||
run_client "netroot=iscsi target1 target2" \
|
||||
"root=LABEL=sysroot" \
|
||||
"ip=dhcp" \
|
||||
"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
|
||||
|
@@ -1,11 +1,11 @@
|
||||
#!/bin/bash
|
||||
TEST_DESCRIPTION="root filesystem over iSCSI"
|
||||
TEST_DESCRIPTION="root filesystem over multiple iSCSI"
|
||||
|
||||
KVERSION=${KVERSION-$(uname -r)}
|
||||
|
||||
DEBUGFAIL="loglevel=1"
|
||||
#DEBUGFAIL="loglevel=1"
|
||||
#DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 "
|
||||
#DEBUGFAIL="rd.debug loglevel=7 "
|
||||
DEBUGFAIL="rd.debug loglevel=7 "
|
||||
#SERVER_DEBUG="rd.debug loglevel=7"
|
||||
#SERIAL="tcp:127.0.0.1:9999"
|
||||
|
||||
@@ -24,7 +24,7 @@ run_server() {
|
||||
${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 \
|
||||
-net socket,listen=127.0.0.1:12331 \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \
|
||||
-initrd $TESTDIR/initramfs.server \
|
||||
@@ -49,7 +49,7 @@ run_client() {
|
||||
-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 \
|
||||
-net socket,connect=127.0.0.1:12331 \
|
||||
-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
|
||||
|
@@ -8,6 +8,11 @@ KVERSION=${KVERSION-$(uname -r)}
|
||||
#DEBUGFAIL="rd.shell rd.break rd.debug systemd.log_target=console loglevel=7 systemd.log_level=debug"
|
||||
#SERIAL="tcp:127.0.0.1:9999"
|
||||
|
||||
test_check() {
|
||||
echo "nbd is constantly broken. skipping"
|
||||
return 1
|
||||
}
|
||||
|
||||
run_server() {
|
||||
# Start server first
|
||||
echo "NBD TEST SETUP: Starting DHCP/NBD server"
|
||||
@@ -107,76 +112,76 @@ client_run() {
|
||||
# The default is ext3,errors=continue so use that to determine
|
||||
# if our options were parsed and used
|
||||
client_test "NBD root=nbd:IP:port" 52:54:00:12:34:00 \
|
||||
"root=nbd:192.168.50.1:raw rd.luks=0" || return 1
|
||||
"root=nbd:192.168.50.1:raw rd.luks=0" || return 1
|
||||
|
||||
client_test "NBD root=nbd:IP:port::fsopts" 52:54:00:12:34:00 \
|
||||
"root=nbd:192.168.50.1:raw::errors=panic rd.luks=0" \
|
||||
ext3 errors=panic || return 1
|
||||
"root=nbd:192.168.50.1:raw::errors=panic rd.luks=0" \
|
||||
ext3 errors=panic || return 1
|
||||
|
||||
client_test "NBD root=nbd:IP:port:fstype" 52:54:00:12:34:00 \
|
||||
"root=nbd:192.168.50.1:raw:ext2 rd.luks=0" ext2 || return 1
|
||||
"root=nbd:192.168.50.1:raw:ext2 rd.luks=0" ext2 || return 1
|
||||
|
||||
client_test "NBD root=nbd:IP:port:fstype:fsopts" 52:54:00:12:34:00 \
|
||||
"root=nbd:192.168.50.1:raw:ext2:errors=panic rd.luks=0" \
|
||||
ext2 errors=panic || return 1
|
||||
"root=nbd:192.168.50.1:raw:ext2:errors=panic rd.luks=0" \
|
||||
ext2 errors=panic || return 1
|
||||
|
||||
client_test "NBD Bridge root=nbd:IP:port:fstype:fsopts" 52:54:00:12:34:00 \
|
||||
"root=nbd:192.168.50.1:raw:ext2:errors=panic bridge rd.luks=0" \
|
||||
ext2 errors=panic || return 1
|
||||
"root=nbd:192.168.50.1:raw:ext2:errors=panic bridge rd.luks=0" \
|
||||
ext2 errors=panic || return 1
|
||||
|
||||
# There doesn't seem to be a good way to validate the NBD options, so
|
||||
# just check that we don't screw up the other options
|
||||
# There doesn't seem to be a good way to validate the NBD options, so
|
||||
# just check that we don't screw up the other options
|
||||
|
||||
client_test "NBD root=nbd:IP:port:::NBD opts" 52:54:00:12:34:00 \
|
||||
"root=nbd:192.168.50.1:raw:::bs=2048 rd.luks=0" || return 1
|
||||
"root=nbd:192.168.50.1:raw:::bs=2048 rd.luks=0" || return 1
|
||||
|
||||
client_test "NBD root=nbd:IP:port:fstype::NBD opts" 52:54:00:12:34:00 \
|
||||
"root=nbd:192.168.50.1:raw:ext2::bs=2048 rd.luks=0" ext2 || return 1
|
||||
"root=nbd:192.168.50.1:raw:ext2::bs=2048 rd.luks=0" ext2 || return 1
|
||||
|
||||
client_test "NBD root=nbd:IP:port:fstype:fsopts:NBD opts" \
|
||||
52:54:00:12:34:00 \
|
||||
"root=nbd:192.168.50.1:raw:ext2:errors=panic:bs=2048 rd.luks=0" \
|
||||
ext2 errors=panic || return 1
|
||||
52:54:00:12:34:00 \
|
||||
"root=nbd:192.168.50.1:raw:ext2:errors=panic:bs=2048 rd.luks=0" \
|
||||
ext2 errors=panic || return 1
|
||||
|
||||
# DHCP root-path parsing
|
||||
|
||||
client_test "NBD root=dhcp DHCP root-path nbd:srv:port" 52:54:00:12:34:01 \
|
||||
"root=dhcp rd.luks=0" || return 1
|
||||
"root=dhcp rd.luks=0" || return 1
|
||||
|
||||
client_test "NBD Bridge root=dhcp DHCP root-path nbd:srv:port" 52:54:00:12:34:01 \
|
||||
"root=dhcp bridge rd.luks=0" || return 1
|
||||
"root=dhcp bridge rd.luks=0" || return 1
|
||||
|
||||
client_test "NBD root=dhcp DHCP root-path nbd:srv:port:fstype" \
|
||||
52:54:00:12:34:02 "root=dhcp rd.luks=0" ext2 || return 1
|
||||
52:54:00:12:34:02 "root=dhcp rd.luks=0" ext2 || return 1
|
||||
|
||||
client_test "NBD root=dhcp DHCP root-path nbd:srv:port::fsopts" \
|
||||
52:54:00:12:34:03 "root=dhcp rd.luks=0" ext3 errors=panic || return 1
|
||||
52:54:00:12:34:03 "root=dhcp rd.luks=0" ext3 errors=panic || return 1
|
||||
|
||||
client_test "NBD root=dhcp DHCP root-path nbd:srv:port:fstype:fsopts" \
|
||||
52:54:00:12:34:04 "root=dhcp rd.luks=0" ext2 errors=panic || return 1
|
||||
52:54:00:12:34:04 "root=dhcp rd.luks=0" ext2 errors=panic || return 1
|
||||
|
||||
# netroot handling
|
||||
|
||||
client_test "NBD netroot=nbd:IP:port" 52:54:00:12:34:00 \
|
||||
"netroot=nbd:192.168.50.1:raw rd.luks=0" || return 1
|
||||
"netroot=nbd:192.168.50.1:raw rd.luks=0" || return 1
|
||||
|
||||
client_test "NBD netroot=dhcp DHCP root-path nbd:srv:port:fstype:fsopts" \
|
||||
52:54:00:12:34:04 "netroot=dhcp rd.luks=0" ext2 errors=panic || return 1
|
||||
52:54:00:12:34:04 "netroot=dhcp rd.luks=0" ext2 errors=panic || return 1
|
||||
|
||||
# Encrypted root handling via LVM/LUKS over NBD
|
||||
|
||||
. $TESTDIR/luks.uuid
|
||||
|
||||
client_test "NBD root=LABEL=dracut netroot=nbd:IP:port" \
|
||||
52:54:00:12:34:00 \
|
||||
"root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=nbd:192.168.50.1:encrypted" || return 1
|
||||
52:54:00:12:34:00 \
|
||||
"root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=nbd:192.168.50.1:encrypted" || return 1
|
||||
|
||||
# XXX This should be ext2,errors=panic but that doesn't currently
|
||||
# XXX work when you have a real root= line in addition to netroot=
|
||||
# XXX How we should work here needs clarification
|
||||
client_test "NBD root=LABEL=dracut netroot=dhcp (w/ fstype and opts)" \
|
||||
52:54:00:12:34:05 \
|
||||
"root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=dhcp" || return 1
|
||||
52:54:00:12:34:05 \
|
||||
"root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=dhcp" || return 1
|
||||
|
||||
if [[ -s server.pid ]]; then
|
||||
sudo kill -TERM $(cat $TESTDIR/server.pid)
|
||||
@@ -197,14 +202,15 @@ make_encrypted_root() {
|
||||
. $basedir/dracut-init.sh
|
||||
mkdir -p "$initdir"
|
||||
(
|
||||
cd "$initdir"; mkdir -p dev sys proc etc var/run tmp
|
||||
mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
|
||||
cd "$initdir"
|
||||
mkdir -p dev sys proc etc var tmp run root usr/bin usr/lib usr/lib64 usr/sbin
|
||||
for i in bin sbin lib lib64; do
|
||||
ln -sfnr usr/$i $i
|
||||
done
|
||||
ln -s ../run var/run
|
||||
)
|
||||
inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
|
||||
mount dmesg mkdir cp ping
|
||||
mount dmesg mkdir cp ping
|
||||
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
||||
[ -f ${_terminfodir}/l/linux ] && break
|
||||
done
|
||||
@@ -221,11 +227,12 @@ make_encrypted_root() {
|
||||
export initdir=$TESTDIR/overlay
|
||||
. $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
|
||||
cd "$initdir"
|
||||
mkdir -p dev sys proc etc tmp var run root usr/bin usr/lib usr/lib64 usr/sbin
|
||||
for i in bin sbin lib lib64; do
|
||||
ln -sfnr usr/$i $i
|
||||
done
|
||||
ln -s ../run var/run
|
||||
)
|
||||
inst_multiple mke2fs poweroff cp umount tune2fs
|
||||
inst_hook shutdown-emergency 000 ./hard-off.sh
|
||||
@@ -239,10 +246,10 @@ make_encrypted_root() {
|
||||
# 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 ext3 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 ext3 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.
|
||||
@@ -269,14 +276,15 @@ make_client_root() {
|
||||
. $basedir/dracut-init.sh
|
||||
mkdir -p "$initdir"
|
||||
(
|
||||
cd "$initdir"; mkdir -p dev sys proc etc var/run tmp
|
||||
mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
|
||||
cd "$initdir"
|
||||
mkdir -p dev sys proc etc var tmp run root usr/bin usr/lib usr/lib64 usr/sbin
|
||||
for i in bin sbin lib lib64; do
|
||||
ln -sfnr usr/$i $i
|
||||
done
|
||||
ln -s ../run var/run
|
||||
)
|
||||
inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
|
||||
dmesg mkdir cp ping
|
||||
dmesg mkdir cp ping
|
||||
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
||||
[ -f ${_terminfodir}/l/linux ] && break
|
||||
done
|
||||
@@ -311,7 +319,8 @@ make_server_root() {
|
||||
mkdir -p "$initdir"
|
||||
(
|
||||
cd "$initdir";
|
||||
mkdir -p dev sys proc etc var/run var/lib/dhcpd tmp etc/nbd-server
|
||||
mkdir -p run dev sys proc etc var var/lib/dhcpd tmp etc/nbd-server
|
||||
ln -s ../run var/run
|
||||
)
|
||||
cat > "$initdir/etc/nbd-server/config" <<EOF
|
||||
[generic]
|
||||
@@ -323,8 +332,8 @@ exportname = /dev/sdc
|
||||
port = 2001
|
||||
EOF
|
||||
inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
|
||||
dmesg mkdir cp ping grep \
|
||||
sleep nbd-server chmod modprobe vi
|
||||
dmesg mkdir cp ping grep \
|
||||
sleep nbd-server chmod modprobe vi
|
||||
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
||||
[ -f ${_terminfodir}/l/linux ] && break
|
||||
done
|
||||
@@ -369,9 +378,9 @@ test_setup() {
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
inst ./cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
|
||||
# inst ./debug-shell.service /lib/systemd/system/debug-shell.service
|
||||
# mkdir -p "${initdir}/lib/systemd/system/sysinit.target.wants"
|
||||
# ln -fs ../debug-shell.service "${initdir}/lib/systemd/system/sysinit.target.wants/debug-shell.service"
|
||||
# inst ./debug-shell.service /lib/systemd/system/debug-shell.service
|
||||
# mkdir -p "${initdir}/lib/systemd/system/sysinit.target.wants"
|
||||
# ln -fs ../debug-shell.service "${initdir}/lib/systemd/system/sysinit.target.wants/debug-shell.service"
|
||||
|
||||
. $TESTDIR/luks.uuid
|
||||
mkdir -p $initdir/etc
|
||||
@@ -380,17 +389,17 @@ test_setup() {
|
||||
)
|
||||
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash udev-rules rootfs-block fs-lib base debug kernel-modules" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext2 ext3 sd_mod e1000" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.server $KVERSION || return 1
|
||||
-m "dash udev-rules rootfs-block fs-lib base debug kernel-modules" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext2 ext3 sd_mod e1000" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.server $KVERSION || return 1
|
||||
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "plymouth" \
|
||||
-a "debug watchdog" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext2 ext3 sd_mod e1000 i6300esb ib700wdt" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.testing $KVERSION || return 1
|
||||
-o "plymouth" \
|
||||
-a "debug watchdog" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext2 ext3 sd_mod e1000 i6300esb ib700wdt" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.testing $KVERSION || return 1
|
||||
}
|
||||
|
||||
kill_server() {
|
||||
|
@@ -12,6 +12,7 @@ run_server() {
|
||||
echo "MULTINIC TEST SETUP: Starting DHCP/NFS server"
|
||||
|
||||
fsck -a "$TESTDIR"/server.ext3 || return 1
|
||||
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file="$TESTDIR"/server.ext3 \
|
||||
-m 512M -smp 2 \
|
||||
@@ -25,6 +26,7 @@ run_server() {
|
||||
-append "panic=1 loglevel=7 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \
|
||||
-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
|
||||
@@ -51,16 +53,18 @@ client_test() {
|
||||
fi
|
||||
|
||||
$testdir/run-qemu -drive format=raw,index=0,media=disk,file="$TESTDIR"/client.img -m 512M -smp 2 -nographic \
|
||||
-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" \
|
||||
-initrd "$TESTDIR"/initramfs.testing
|
||||
-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 \
|
||||
-netdev hubport,id=n1,hubid=1 \
|
||||
-netdev hubport,id=n2,hubid=2 \
|
||||
-device e1000,netdev=n1,mac=52:54:00:12:34:98 \
|
||||
-device e1000,netdev=n2,mac=52:54:00:12:34:99 \
|
||||
-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" \
|
||||
-initrd "$TESTDIR"/initramfs.testing
|
||||
|
||||
{ read OK; read IFACES; } < "$TESTDIR"/client.img
|
||||
|
||||
@@ -108,58 +112,58 @@ test_client() {
|
||||
|
||||
# PXE Style BOOTIF=
|
||||
client_test "MULTINIC root=nfs BOOTIF=" \
|
||||
00 01 02 \
|
||||
"root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00" \
|
||||
"ens3" || return 1
|
||||
00 01 02 \
|
||||
"root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00" \
|
||||
"ens3" || return 1
|
||||
|
||||
client_test "MULTINIC root=nfs BOOTIF= ip=ens4:dhcp" \
|
||||
00 01 02 \
|
||||
"root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00 ip=ens4:dhcp" \
|
||||
"ens3 ens4" || return 1
|
||||
00 01 02 \
|
||||
"root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00 ip=ens4:dhcp" \
|
||||
"ens3 ens4" || return 1
|
||||
|
||||
# PXE Style BOOTIF= with dhcp root-path
|
||||
client_test "MULTINIC root=dhcp BOOTIF=" \
|
||||
00 01 02 \
|
||||
"root=dhcp BOOTIF=52-54-00-12-34-02" \
|
||||
"ens5" || return 1
|
||||
00 01 02 \
|
||||
"root=dhcp BOOTIF=52-54-00-12-34-02" \
|
||||
"ens5" || return 1
|
||||
|
||||
# Multinic case, where only one nic works
|
||||
client_test "MULTINIC root=nfs ip=dhcp" \
|
||||
FF 00 FE \
|
||||
"root=nfs:192.168.50.1:/nfs/client ip=dhcp" \
|
||||
"ens4" || return 1
|
||||
FF 00 FE \
|
||||
"root=nfs:192.168.50.1:/nfs/client ip=dhcp" \
|
||||
"ens4" || return 1
|
||||
|
||||
# Require two interfaces
|
||||
client_test "MULTINIC root=nfs ip=ens4:dhcp ip=ens5:dhcp bootdev=ens4" \
|
||||
00 01 02 \
|
||||
"root=nfs:192.168.50.1:/nfs/client ip=ens4:dhcp ip=ens5:dhcp bootdev=ens4" \
|
||||
"ens4 ens5" || return 1
|
||||
00 01 02 \
|
||||
"root=nfs:192.168.50.1:/nfs/client ip=ens4:dhcp ip=ens5:dhcp bootdev=ens4" \
|
||||
"ens4 ens5" || return 1
|
||||
|
||||
# Require three interfaces with dhcp root-path
|
||||
client_test "MULTINIC root=dhcp ip=ens3:dhcp ip=ens4:dhcp ip=ens5:dhcp bootdev=ens5" \
|
||||
00 01 02 \
|
||||
"root=dhcp ip=ens3:dhcp ip=ens4:dhcp ip=ens5:dhcp bootdev=ens5" \
|
||||
"ens3 ens4 ens5" || return 1
|
||||
00 01 02 \
|
||||
"root=dhcp ip=ens3:dhcp ip=ens4:dhcp ip=ens5:dhcp bootdev=ens5" \
|
||||
"ens3 ens4 ens5" || return 1
|
||||
|
||||
client_test "MULTINIC bonding" \
|
||||
00 01 02 \
|
||||
"root=nfs:192.168.50.1:/nfs/client ip=bond0:dhcp bond=bond0:ens3,ens4,ens5:mode=balance-rr" \
|
||||
"bond0" || return 1
|
||||
00 01 02 \
|
||||
"root=nfs:192.168.50.1:/nfs/client ip=bond0:dhcp bond=bond0:ens3,ens4,ens5:mode=balance-rr" \
|
||||
"bond0" || return 1
|
||||
|
||||
client_test "MULTINIC bridging" \
|
||||
00 01 02 \
|
||||
"root=nfs:192.168.50.1:/nfs/client ip=bridge0:dhcp bridge=bridge0:ens3,ens6,ens7" \
|
||||
"bridge0" || return 1
|
||||
00 01 02 \
|
||||
"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
|
||||
# Make server root
|
||||
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
|
||||
|
||||
kernel=$KVERSION
|
||||
(
|
||||
export initdir="$TESTDIR"/mnt
|
||||
. "$basedir"/dracut-init.sh
|
||||
@@ -183,9 +187,9 @@ test_setup() {
|
||||
done
|
||||
|
||||
inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
|
||||
dmesg mkdir cp ping exportfs \
|
||||
modprobe rpc.nfsd rpc.mountd showmount tcpdump \
|
||||
/etc/services sleep mount chmod
|
||||
dmesg mkdir cp ping exportfs \
|
||||
modprobe rpc.nfsd rpc.mountd showmount tcpdump \
|
||||
/etc/services sleep mount chmod
|
||||
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
||||
[ -f "${_terminfodir}"/l/linux ] && break
|
||||
done
|
||||
@@ -210,7 +214,7 @@ test_setup() {
|
||||
inst_libdir_file 'libnfsidmap*.so*'
|
||||
|
||||
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
|
||||
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
|
||||
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
|
||||
_nsslibs=${_nsslibs#|}
|
||||
_nsslibs=${_nsslibs%|}
|
||||
|
||||
@@ -239,7 +243,7 @@ test_setup() {
|
||||
done
|
||||
)
|
||||
inst_multiple sh shutdown poweroff stty cat ps ln ip \
|
||||
mount dmesg mkdir cp ping grep ls
|
||||
mount dmesg mkdir cp ping grep ls
|
||||
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
||||
[[ -f ${_terminfodir}/l/linux ]] && break
|
||||
done
|
||||
@@ -256,7 +260,7 @@ test_setup() {
|
||||
inst_libdir_file 'libnfsidmap*.so*'
|
||||
|
||||
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' -- /etc/nsswitch.conf \
|
||||
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
|
||||
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
|
||||
_nsslibs=${_nsslibs#|}
|
||||
_nsslibs=${_nsslibs%|}
|
||||
|
||||
@@ -280,14 +284,16 @@ test_setup() {
|
||||
)
|
||||
|
||||
# Make server's dracut image
|
||||
$basedir/dracut.sh -l -i "$TESTDIR"/overlay / \
|
||||
$basedir/dracut.sh \
|
||||
-l -i "$TESTDIR"/overlay / \
|
||||
-m "dash udev-rules base rootfs-block fs-lib debug kernel-modules watchdog" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd e1000 i6300esb ib700wdt" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f "$TESTDIR"/initramfs.server "$KVERSION" || return 1
|
||||
|
||||
# Make client's dracut image
|
||||
$basedir/dracut.sh -l -i "$TESTDIR"/overlay / \
|
||||
$basedir/dracut.sh \
|
||||
-l -i "$TESTDIR"/overlay / \
|
||||
-o "plymouth" \
|
||||
-a "debug" \
|
||||
-d "af_packet piix sd_mod sr_mod ata_piix ide-gd_mod e1000 nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files sunrpc i6300esb ib700wdt" \
|
||||
|
@@ -49,7 +49,7 @@ linkup() {
|
||||
&& wait_for_if_up $1 2>/dev/null
|
||||
}
|
||||
|
||||
modprobe -b -q 8021q
|
||||
modprobe --all -b -q 8021q ipvlan macvlan
|
||||
>/dev/watchdog
|
||||
ip addr add 127.0.0.1/8 dev lo
|
||||
linkup lo
|
||||
@@ -67,6 +67,10 @@ ip addr add 192.168.55.1/24 dev ens4.2
|
||||
ip addr add 192.168.56.1/24 dev ens4.3
|
||||
ip addr add 192.168.57.1/24 dev ens4.4
|
||||
linkup ens4
|
||||
ip link set dev ens4.1 up
|
||||
ip link set dev ens4.2 up
|
||||
ip link set dev ens4.3 up
|
||||
ip link set dev ens4.4 up
|
||||
ip link set dev eth2 name ens5
|
||||
ip addr add 192.168.51.1/24 dev ens5
|
||||
linkup ens5
|
||||
|
@@ -14,18 +14,19 @@ run_server() {
|
||||
echo "MULTINIC TEST SETUP: Starting DHCP/NFS server"
|
||||
|
||||
fsck -a "$TESTDIR"/server.ext3 || return 1
|
||||
|
||||
$testdir/run-qemu \
|
||||
-hda "$TESTDIR"/server.ext3 \
|
||||
-m 512M -smp 2 \
|
||||
-display none \
|
||||
-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 \
|
||||
-net nic,vlan=3,macaddr=52:54:01:12:34:59,model=e1000 \
|
||||
-netdev socket,id=n0,listen=127.0.0.1:12370 \
|
||||
-netdev socket,id=n1,listen=127.0.0.1:12371 \
|
||||
-netdev socket,id=n2,listen=127.0.0.1:12372 \
|
||||
-netdev socket,id=n3,listen=127.0.0.1:12373 \
|
||||
-device e1000,netdev=n0,mac=52:54:01:12:34:56 \
|
||||
-device e1000,netdev=n1,mac=52:54:01:12:34:57 \
|
||||
-device e1000,netdev=n2,mac=52:54:01:12:34:58 \
|
||||
-device e1000,netdev=n3,mac=52:54:01:12:34:59 \
|
||||
${SERIAL:+-serial "$SERIAL"} \
|
||||
${SERIAL:--serial file:"$TESTDIR"/server.log} \
|
||||
-watchdog i6300esb -watchdog-action poweroff \
|
||||
@@ -58,21 +59,45 @@ client_test() {
|
||||
echo "Unable to make client sda image" 1>&2
|
||||
return 1
|
||||
fi
|
||||
if [[ $do_vlan13 ]]; then
|
||||
nic1=" -netdev socket,connect=127.0.0.1:12371,id=n1"
|
||||
nic3=" -netdev socket,connect=127.0.0.1:12373,id=n3"
|
||||
else
|
||||
nic1=" -netdev hubport,id=n1,hubid=2"
|
||||
nic3=" -netdev hubport,id=n3,hubid=3"
|
||||
fi
|
||||
|
||||
$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 \
|
||||
-net nic,vlan=2,macaddr=52:54:00:12:34:04,model=e1000 \
|
||||
-net nic,vlan=3,macaddr=52:54:00:12:34:05,model=e1000 \
|
||||
-watchdog i6300esb -watchdog-action poweroff \
|
||||
-no-reboot \
|
||||
-append "panic=1 $cmdline rd.debug $DEBUGFAIL rd.retry=5 rw console=ttyS0,115200n81 selinux=0 init=/sbin/init" \
|
||||
-initrd "$TESTDIR"/initramfs.testing
|
||||
if $testdir/run-qemu --help | grep -qF -m1 'netdev hubport,id=str,hubid=n[,netdev=nd]' && echo OK; then
|
||||
$testdir/run-qemu \
|
||||
-hda "$TESTDIR"/client.img -m 512M -smp 2 -nographic \
|
||||
-netdev socket,connect=127.0.0.1:12370,id=s1 \
|
||||
-netdev hubport,hubid=1,id=h1,netdev=s1 \
|
||||
-netdev hubport,hubid=1,id=h2 -device e1000,mac=52:54:00:12:34:01,netdev=h2 \
|
||||
-netdev hubport,hubid=1,id=h3 -device e1000,mac=52:54:00:12:34:02,netdev=h3 \
|
||||
$nic1 -device e1000,mac=52:54:00:12:34:03,netdev=n1 \
|
||||
-netdev socket,connect=127.0.0.1:12372,id=n2 -device e1000,mac=52:54:00:12:34:04,netdev=n2 \
|
||||
$nic3 -device e1000,mac=52:54:00:12:34:05,netdev=n3 \
|
||||
-watchdog i6300esb -watchdog-action poweroff \
|
||||
-no-reboot \
|
||||
-append "panic=1 $cmdline rd.debug $DEBUGFAIL rd.retry=5 rw console=ttyS0,115200n81 selinux=0 init=/sbin/init" \
|
||||
-initrd "$TESTDIR"/initramfs.testing
|
||||
else
|
||||
$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 \
|
||||
-net nic,vlan=2,macaddr=52:54:00:12:34:04,model=e1000 \
|
||||
-net nic,vlan=3,macaddr=52:54:00:12:34:05,model=e1000 \
|
||||
-watchdog i6300esb -watchdog-action poweroff \
|
||||
-no-reboot \
|
||||
-append "panic=1 $cmdline rd.debug $DEBUGFAIL rd.retry=5 rw console=ttyS0,115200n81 selinux=0 init=/sbin/init" \
|
||||
-initrd "$TESTDIR"/initramfs.testing
|
||||
fi
|
||||
|
||||
{
|
||||
read OK
|
||||
@@ -113,19 +138,19 @@ test_client() {
|
||||
client_test "Multiple VLAN" \
|
||||
"yes" \
|
||||
"
|
||||
vlan=vlan0001:ens4
|
||||
vlan=vlan2:ens4
|
||||
vlan=ens4.3:ens4
|
||||
vlan=ens4.0004:ens4
|
||||
vlan=vlan0001:ens5
|
||||
vlan=vlan2:ens5
|
||||
vlan=ens5.3:ens5
|
||||
vlan=ens5.0004:ens5
|
||||
ip=ens3:dhcp
|
||||
ip=192.168.54.101::192.168.54.1:24:test:vlan0001:none
|
||||
ip=192.168.55.102::192.168.55.1:24:test:vlan2:none
|
||||
ip=192.168.56.103::192.168.56.1:24:test:ens4.3:none
|
||||
ip=192.168.57.104::192.168.57.1:24:test:ens4.0004:none
|
||||
ip=192.168.56.103::192.168.56.1:24:test:ens5.3:none
|
||||
ip=192.168.57.104::192.168.57.1:24:test:ens5.0004:none
|
||||
rd.neednet=1
|
||||
root=nfs:192.168.50.1:/nfs/client bootdev=ens3
|
||||
" \
|
||||
'ens3 ens4.0004 ens4.3 vlan0001 vlan2 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens3 # Generated by dracut initrd NAME="ens3" DEVICE="ens3" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp TYPE=Ethernet /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens4.0004 # Generated by dracut initrd NAME="ens4.0004" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.57.104" PREFIX="24" GATEWAY="192.168.57.1" TYPE=Vlan DEVICE="ens4.0004" VLAN=yes PHYSDEV="ens4" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens4.3 # Generated by dracut initrd NAME="ens4.3" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.56.103" PREFIX="24" GATEWAY="192.168.56.1" TYPE=Vlan DEVICE="ens4.3" VLAN=yes PHYSDEV="ens4" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-vlan0001 # Generated by dracut initrd NAME="vlan0001" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.54.101" PREFIX="24" GATEWAY="192.168.54.1" TYPE=Vlan DEVICE="vlan0001" VLAN=yes PHYSDEV="ens4" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-vlan2 # Generated by dracut initrd NAME="vlan2" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.55.102" PREFIX="24" GATEWAY="192.168.55.1" TYPE=Vlan DEVICE="vlan2" VLAN=yes PHYSDEV="ens4" EOF ' \
|
||||
'ens3 ens5.0004 ens5.3 vlan0001 vlan2 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens3 # Generated by dracut initrd NAME="ens3" DEVICE="ens3" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp TYPE=Ethernet /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens5.0004 # Generated by dracut initrd NAME="ens5.0004" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.57.104" PREFIX="24" GATEWAY="192.168.57.1" TYPE=Vlan DEVICE="ens5.0004" VLAN=yes PHYSDEV="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens5.3 # Generated by dracut initrd NAME="ens5.3" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.56.103" PREFIX="24" GATEWAY="192.168.56.1" TYPE=Vlan DEVICE="ens5.3" VLAN=yes PHYSDEV="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-vlan0001 # Generated by dracut initrd NAME="vlan0001" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.54.101" PREFIX="24" GATEWAY="192.168.54.1" TYPE=Vlan DEVICE="vlan0001" VLAN=yes PHYSDEV="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-vlan2 # Generated by dracut initrd NAME="vlan2" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.55.102" PREFIX="24" GATEWAY="192.168.55.1" TYPE=Vlan DEVICE="vlan2" VLAN=yes PHYSDEV="ens5" EOF ' \
|
||||
|| return 1
|
||||
|
||||
client_test "Multiple Bonds" \
|
||||
@@ -164,7 +189,7 @@ test_setup() {
|
||||
mke2fs -j -F -- "$TESTDIR"/server.ext3
|
||||
mkdir -- "$TESTDIR"/mnt
|
||||
mount -o loop -- "$TESTDIR"/server.ext3 "$TESTDIR"/mnt
|
||||
|
||||
kernel=$KVERSION
|
||||
(
|
||||
export initdir="$TESTDIR"/mnt
|
||||
. "$basedir"/dracut-init.sh
|
||||
@@ -200,7 +225,7 @@ test_setup() {
|
||||
[ -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
|
||||
instmods nfsd sunrpc ipv6 lockd af_packet 8021q
|
||||
instmods nfsd sunrpc ipv6 lockd af_packet 8021q ipvlan macvlan
|
||||
inst_simple /etc/os-release
|
||||
inst ./server-init.sh /sbin/init
|
||||
inst ./hosts /etc/hosts
|
||||
@@ -283,7 +308,7 @@ test_setup() {
|
||||
$basedir/dracut.sh -l -i "$TESTDIR"/overlay / \
|
||||
--no-early-microcode \
|
||||
-m "udev-rules base rootfs-block fs-lib debug kernel-modules watchdog" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd e1000 i6300esb ib700wdt" \
|
||||
-d "ipvlan macvlan af_packet piix ide-gd_mod ata_piix ext3 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd e1000 i6300esb ib700wdt" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f "$TESTDIR"/initramfs.server "$KVERSION" || return 1
|
||||
|
||||
@@ -292,7 +317,7 @@ test_setup() {
|
||||
--no-early-microcode \
|
||||
-o "plymouth" \
|
||||
-a "debug" \
|
||||
-d "af_packet piix sd_mod sr_mod ata_piix ide-gd_mod e1000 nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files sunrpc i6300esb ib700wdt" \
|
||||
-d "ipvlan macvlan af_packet piix sd_mod sr_mod ata_piix ide-gd_mod e1000 nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files sunrpc i6300esb ib700wdt" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
|
||||
}
|
||||
|
@@ -30,12 +30,12 @@ test_run() {
|
||||
"$TESTDIR"/dracut-[0-9]*.$(arch).rpm \
|
||||
"$TESTDIR"/dracut-network-[0-9]*.$(arch).rpm \
|
||||
"$rootdir/$TESTDIR/"
|
||||
|
||||
. /etc/os-release
|
||||
dnf_or_yum=yum
|
||||
dnf_or_yum_cmd=yum
|
||||
command -v dnf >/dev/null && { dnf_or_yum="dnf"; dnf_or_yum_cmd="dnf --allowerasing"; }
|
||||
for (( i=0; i < 5 ; i++)); do
|
||||
$dnf_or_yum_cmd -v --nogpgcheck --installroot "$rootdir"/ --releasever 29 --disablerepo='*' \
|
||||
$dnf_or_yum_cmd -v --nogpgcheck --installroot "$rootdir"/ --releasever "$VERSION_ID" --disablerepo='*' \
|
||||
--enablerepo=fedora --enablerepo=updates \
|
||||
install -y \
|
||||
$dnf_or_yum \
|
||||
|
@@ -4,11 +4,12 @@
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
[[ -x /usr/bin/qemu ]] && BIN=/usr/bin/qemu && ARGS=""
|
||||
$(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"
|
||||
$(lsmod | grep -q '^kqemu ') && BIN=/usr/bin/qemu && ARGS="-kernel-kqemu -cpu host"
|
||||
[[ -c /dev/kvm && -x /usr/bin/kvm ]] && BIN=/usr/bin/kvm && ARGS="-cpu host"
|
||||
[[ -c /dev/kvm && -x /usr/bin/qemu-kvm ]] && BIN=/usr/bin/qemu-kvm && ARGS="-cpu host"
|
||||
[[ -c /dev/kvm && -x /usr/libexec/qemu-kvm ]] && BIN=/usr/libexec/qemu-kvm && ARGS="-cpu host"
|
||||
[[ -x /usr/bin/qemu-system-$(uname -i) ]] && BIN=/usr/bin/qemu-system-$(uname -i) && ARGS=""
|
||||
[[ -c /dev/kvm && -x /usr/bin/qemu-system-$(uname -i) ]] && BIN=/usr/bin/qemu-system-$(uname -i) && ARGS="-enable-kvm -cpu host"
|
||||
|
||||
[[ $BIN ]] || {
|
||||
echo "Could not find a working KVM or QEMU to test with!" >&2
|
||||
@@ -30,4 +31,4 @@ if ! [ -f "$VMLINUZ" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
exec sudo $BIN $ARGS -kernel $VMLINUZ -cpu host "$@"
|
||||
exec sudo $BIN $ARGS -kernel $VMLINUZ "$@"
|
||||
|
@@ -2,16 +2,16 @@
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export PATH
|
||||
|
||||
[[ -e .testdir ]] && . .testdir
|
||||
[[ -e .testdir${TEST_RUN_ID:+-$TEST_RUN_ID} ]] && . .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
|
||||
if [[ -z "$TESTDIR" ]] || [[ ! -d "$TESTDIR" ]]; then
|
||||
TESTDIR=$(mktemp -d -p "/var/tmp" -t dracut-test.XXXXXX)
|
||||
TESTDIR=$(mktemp -d -p "/var/tmp" -t dracut-test.XXXXXX)
|
||||
fi
|
||||
echo "TESTDIR=\"$TESTDIR\"" > .testdir
|
||||
echo "TESTDIR=\"$TESTDIR\"" > .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
|
||||
export TESTDIR
|
||||
|
||||
command -v test_check &>/dev/null || test_check() {
|
||||
:
|
||||
}
|
||||
:
|
||||
}
|
||||
|
||||
# terminal sequence to set color to a 'success' color (currently: green)
|
||||
function SETCOLOR_SUCCESS() { echo -en '\033[0;32m'; }
|
||||
@@ -22,6 +22,11 @@ function SETCOLOR_WARNING() { echo -en '\033[0;33m'; }
|
||||
# terminal sequence to reset to the default color.
|
||||
function SETCOLOR_NORMAL() { echo -en '\033[0;39m'; }
|
||||
|
||||
COLOR_SUCCESS='\033[0;32m'
|
||||
COLOR_FAILURE='\033[0;31m'
|
||||
COLOR_WARNING='\033[0;33m'
|
||||
COLOR_NORMAL='\033[0;39m'
|
||||
|
||||
check_root() {
|
||||
if (( $EUID != 0 )); then
|
||||
SETCOLOR_FAILURE; echo "Tests must be run as root! Please use 'sudo'."; SETCOLOR_NORMAL
|
||||
@@ -33,63 +38,79 @@ while (($# > 0)); do
|
||||
case $1 in
|
||||
--run)
|
||||
check_root
|
||||
echo "TEST RUN: $TEST_DESCRIPTION"
|
||||
test_check && test_run
|
||||
exit $?;;
|
||||
echo "TEST RUN: $TEST_DESCRIPTION"
|
||||
test_check && test_run
|
||||
exit $?;;
|
||||
--setup)
|
||||
check_root
|
||||
echo "TEST SETUP: $TEST_DESCRIPTION"
|
||||
test_check && test_setup
|
||||
exit $?;;
|
||||
echo "TEST SETUP: $TEST_DESCRIPTION"
|
||||
test_check && test_setup
|
||||
exit $?;;
|
||||
--clean)
|
||||
echo "TEST CLEANUP: $TEST_DESCRIPTION"
|
||||
test_cleanup
|
||||
rm -fr -- "$TESTDIR"
|
||||
rm -f -- .testdir
|
||||
exit $?;;
|
||||
echo "TEST CLEANUP: $TEST_DESCRIPTION"
|
||||
test_cleanup
|
||||
rm -fr -- "$TESTDIR"
|
||||
rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
|
||||
exit $?;;
|
||||
--all)
|
||||
check_root
|
||||
echo -n "TEST: $TEST_DESCRIPTION ";
|
||||
if ! test_check 2&>test.log ; then
|
||||
SETCOLOR_WARNING
|
||||
echo "[SKIPPED]"
|
||||
SETCOLOR_NORMAL
|
||||
exit 0;
|
||||
fi
|
||||
if [ "$V" != "1" ]; then
|
||||
(
|
||||
test_setup && test_run
|
||||
ret=$?
|
||||
test_cleanup
|
||||
rm -fr -- "$TESTDIR"
|
||||
rm -f -- .testdir
|
||||
exit $ret
|
||||
) </dev/null >test.log 2>&1
|
||||
if ! test_check 2&>test${TEST_RUN_ID:+-$TEST_RUN_ID}.log ; then
|
||||
echo -e "TEST: $TEST_DESCRIPTION " $COLOR_WARNING "[SKIPPED]" $COLOR_NORMAL
|
||||
exit 0;
|
||||
else
|
||||
set -o pipefail
|
||||
(
|
||||
test_setup && test_run
|
||||
ret=$?
|
||||
test_cleanup
|
||||
rm -fr -- "$TESTDIR"
|
||||
rm -f -- .testdir
|
||||
exit $ret
|
||||
) </dev/null 2>&1 | tee test.log
|
||||
echo "TEST: $TEST_DESCRIPTION [STARTED]";
|
||||
fi
|
||||
ret=$?
|
||||
if [[ "$V" == "1" ]]; then
|
||||
set -o pipefail
|
||||
(
|
||||
test_setup && test_run
|
||||
ret=$?
|
||||
test_cleanup
|
||||
if ((ret!=0)) && [[ -f "$TESTDIR"/server.log ]]; then
|
||||
mv [[ -f "$TESTDIR"/server.log ]] ./server${TEST_RUN_ID:+-$TEST_RUN_ID}.log
|
||||
fi
|
||||
rm -fr -- "$TESTDIR"
|
||||
rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
|
||||
exit $ret
|
||||
) </dev/null 2>&1 | tee test${TEST_RUN_ID:+-$TEST_RUN_ID}.log
|
||||
elif [[ "$V" == "2" ]]; then
|
||||
set -o pipefail
|
||||
(
|
||||
test_setup && test_run
|
||||
ret=$?
|
||||
test_cleanup
|
||||
if ((ret!=0)) && [[ -f "$TESTDIR"/server.log ]]; then
|
||||
mv [[ -f "$TESTDIR"/server.log ]] ./server${TEST_RUN_ID:+-$TEST_RUN_ID}.log
|
||||
fi
|
||||
rm -fr -- "$TESTDIR"
|
||||
rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
|
||||
exit $ret
|
||||
) </dev/null 2>&1 | $basedir/logtee test${TEST_RUN_ID:+-$TEST_RUN_ID}.log
|
||||
else
|
||||
(
|
||||
test_setup && test_run
|
||||
ret=$?
|
||||
test_cleanup
|
||||
rm -fr -- "$TESTDIR"
|
||||
rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
|
||||
exit $ret
|
||||
) </dev/null >test${TEST_RUN_ID:+-$TEST_RUN_ID}.log 2>&1
|
||||
fi
|
||||
ret=$?
|
||||
set +o pipefail
|
||||
if [ $ret -eq 0 ]; then
|
||||
rm -- test.log
|
||||
SETCOLOR_SUCCESS
|
||||
echo "[OK]"
|
||||
SETCOLOR_NORMAL
|
||||
else
|
||||
SETCOLOR_FAILURE
|
||||
echo "[FAILED]"
|
||||
SETCOLOR_NORMAL
|
||||
echo "see $(pwd)/test.log"
|
||||
fi
|
||||
exit $ret;;
|
||||
if [ $ret -eq 0 ]; then
|
||||
rm -- test${TEST_RUN_ID:+-$TEST_RUN_ID}.log
|
||||
echo -e "TEST: $TEST_DESCRIPTION " $COLOR_SUCCESS "[OK]" $COLOR_NORMAL
|
||||
else
|
||||
echo -e "TEST: $TEST_DESCRIPTION " $COLOR_FAILURE "[FAILED]" $COLOR_NORMAL
|
||||
if [ "$V" == "2" ]; then
|
||||
tail -c 1048576 $(pwd)/server${TEST_RUN_ID:+-$TEST_RUN_ID}.log $(pwd)/test${TEST_RUN_ID:+-$TEST_RUN_ID}.log
|
||||
echo -e "TEST: $TEST_DESCRIPTION " $COLOR_FAILURE "[FAILED]" $COLOR_NORMAL
|
||||
else
|
||||
echo "see $(pwd)/test${TEST_RUN_ID:+-$TEST_RUN_ID}.log"
|
||||
fi
|
||||
fi
|
||||
exit $ret;;
|
||||
*) break ;;
|
||||
esac
|
||||
shift
|
||||
|
Reference in New Issue
Block a user