Skip to content

Commit 40dd5c9

Browse files
LaszloGombosaafeijoo-suse
authored andcommitted
feat(overlayfs): add a new module called overlayfs
Also split ovlfs variable with two different meaning.
1 parent 8caaad4 commit 40dd5c9

File tree

8 files changed

+35
-13
lines changed

8 files changed

+35
-13
lines changed

.github/labeler.yml

+3
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ multipath:
141141
nvdimm:
142142
- modules.d/90nvdimm/*
143143

144+
overlayfs:
145+
- modules.d/90overlayfs/*
146+
144147
ppcmac:
145148
- modules.d/90ppcmac/*
146149

modules.d/90dmsquash-live/dmsquash-live-genrules.sh

-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,4 @@ case "$root" in
1515
/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root "${root#live:}"
1616
fi
1717
;;
18-
nfs*)
19-
cp /sbin/mount-overlayfs "$hookdir/mount/99-mount-overlayfs.sh"
20-
;;
2118
esac

modules.d/90dmsquash-live/dmsquash-live-root.sh

-3
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,6 @@ if [ -n "$overlayfs" ]; then
425425
else
426426
ln -sf /run/initramfs/live /run/rootfsbase
427427
fi
428-
if [ -z "$DRACUT_SYSTEMD" ]; then
429-
ln -sf /sbin/mount-overlayfs "$hookdir"/mount/01-$$-live.sh
430-
fi
431428
else
432429
if [ -z "$DRACUT_SYSTEMD" ]; then
433430
[ -n "$ROOTFLAGS" ] && ROOTFLAGS="-o $ROOTFLAGS"

modules.d/90dmsquash-live/module-setup.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ check() {
1111
depends() {
1212
# if dmsetup is not installed, then we cannot support fedora/red hat
1313
# style live images
14-
echo dm rootfs-block img-lib
14+
echo dm rootfs-block img-lib overlayfs
1515
return 0
1616
}
1717

1818
# called by dracut
1919
installkernel() {
20-
instmods squashfs loop iso9660 overlay
20+
instmods squashfs loop iso9660
2121
}
2222

2323
# called by dracut
@@ -31,7 +31,6 @@ install() {
3131
inst_hook pre-pivot 20 "$moddir/apply-live-updates.sh"
3232
inst_script "$moddir/dmsquash-live-root.sh" "/sbin/dmsquash-live-root"
3333
inst_script "$moddir/iso-scan.sh" "/sbin/iso-scan"
34-
inst_script "$moddir/mount-overlayfs.sh" "/sbin/mount-overlayfs"
3534
if dracut_module_included "systemd-initrd"; then
3635
inst_script "$moddir/dmsquash-generator.sh" "$systemdutildir"/system-generators/dracut-dmsquash-generator
3736
inst_simple "$moddir/[email protected]" "/etc/systemd/system/[email protected]"

modules.d/90overlayfs/module-setup.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
check() {
4+
[[ $hostonly ]] && return 1
5+
return 255
6+
}
7+
8+
depends() {
9+
echo base
10+
}
11+
12+
installkernel() {
13+
instmods overlay
14+
}
15+
16+
install() {
17+
inst_hook mount 01 "$moddir/mount-overlayfs.sh"
18+
}

modules.d/90dmsquash-live/mount-overlayfs.sh renamed to modules.d/90overlayfs/mount-overlayfs.sh

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
44

5-
PATH=/usr/sbin:/usr/bin:/sbin:/bin
6-
75
getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
86
getargbool 0 rd.live.overlay.reset -d -y reset_overlay && reset_overlay="yes"
97
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
@@ -19,9 +17,9 @@ if [ -n "$overlayfs" ]; then
1917
mkdir -m 0755 -p /run/overlayfs
2018
mkdir -m 0755 -p /run/ovlwork
2119
if [ -n "$reset_overlay" ] && [ -h /run/overlayfs ]; then
22-
ovlfs=$(readlink /run/overlayfs)
20+
ovlfsdir=$(readlink /run/overlayfs)
2321
info "Resetting the OverlayFS overlay directory."
24-
rm -r -- "${ovlfs:?}"/* "${ovlfs:?}"/.* > /dev/null 2>&1
22+
rm -r -- "${ovlfsdir:?}"/* "${ovlfsdir:?}"/.* > /dev/null 2>&1
2523
fi
2624
if [ -n "$readonly_overlay" ] && [ -h /run/overlayfs-r ]; then
2725
ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase

test/TEST-16-DMSQUASH/test.sh

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ test_run() {
1717
qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
1818
qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root
1919

20+
"$testdir"/run-qemu \
21+
"${disk_args[@]}" \
22+
-boot order=d \
23+
-append "rd.live.overlay.overlayfs=1 root=LABEL=dracut console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \
24+
-initrd "$TESTDIR"/initramfs.testing
25+
2026
"$testdir"/run-qemu \
2127
"${disk_args[@]}" \
2228
-boot order=d \

test/TEST-20-NFS/test.sh

+4
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ test_nfsv3() {
182182
"root=dhcp" 192.168.50.3 wsize=4096 || return 1
183183

184184
client_test "NFSv3 Overlayfs root=nfs:..." 52:54:00:12:34:04 \
185+
"root=nfs:192.168.50.1:/nfs/client rd.live.overlay.overlayfs=1" \
186+
192.168.50.1 -wsize=4096 || return 1
187+
188+
client_test "NFSv3 Live Overlayfs root=nfs:..." 52:54:00:12:34:04 \
185189
"root=nfs:192.168.50.1:/nfs/client rd.live.image rd.live.overlay.overlayfs=1" \
186190
192.168.50.1 -wsize=4096 || return 1
187191

0 commit comments

Comments
 (0)