/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root "${root#live:}"
fi
;;
+ nfs*)
+ cp /sbin/mount-overlayfs "$hookdir/mount/99-mount-overlayfs.sh"
+ ;;
esac
else
ln -sf /run/initramfs/live /run/rootfsbase
fi
- mkdir -m 0755 -p /run/overlayfs
- mkdir -m 0755 -p /run/ovlwork
- 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" ] && [ -h /run/overlayfs-r ]; then
- ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
- else
- ovlfs=lowerdir=/run/rootfsbase
- fi
if [ -z "$DRACUT_SYSTEMD" ]; then
- printf 'mount -t overlay LiveOS_rootfs -o%s,%s %s\n' "$ROOTFLAGS" \
- "$ovlfs",upperdir=/run/overlayfs,workdir=/run/ovlwork \
- "$NEWROOT" > "$hookdir"/mount/01-$$-live.sh
+ ln -sf /sbin/mount-overlayfs "$hookdir"/mount/01-$$-live.sh
fi
else
if [ -z "$DRACUT_SYSTEMD" ]; then
inst_hook pre-pivot 20 "$moddir/apply-live-updates.sh"
inst_script "$moddir/dmsquash-live-root.sh" "/sbin/dmsquash-live-root"
inst_script "$moddir/iso-scan.sh" "/sbin/iso-scan"
+ inst_script "$moddir/mount-overlayfs.sh" "/sbin/mount-overlayfs"
if dracut_module_included "systemd-initrd"; then
inst_script "$moddir/dmsquash-generator.sh" "$systemdutildir"/system-generators/dracut-dmsquash-generator
inst_simple "$moddir/checkisomd5@.service" "/etc/systemd/system/checkisomd5@.service"
--- /dev/null
+#!/bin/sh
+
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
+
+PATH=/usr/sbin:/usr/bin:/sbin:/bin
+
+getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
+getargbool 0 rd.live.overlay.reset -d -y reset_overlay && reset_overlay="yes"
+getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
+
+ROOTFLAGS="$(getarg rootflags)"
+
+if [ -n "$overlayfs" ]; then
+ if ! [ -e /run/rootfsbase ]; then
+ mkdir -m 0755 -p /run/rootfsbase
+ mount --bind "$NEWROOT" /run/rootfsbase
+ fi
+
+ mkdir -m 0755 -p /run/overlayfs
+ mkdir -m 0755 -p /run/ovlwork
+ 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" ] && [ -h /run/overlayfs-r ]; then
+ ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
+ else
+ ovlfs=lowerdir=/run/rootfsbase
+ fi
+
+ if ! strstr "$(cat /proc/mounts)" LiveOS_rootfs; then
+ mount -t overlay LiveOS_rootfs -o "$ROOTFLAGS,$ovlfs",upperdir=/run/overlayfs,workdir=/run/ovlwork "$NEWROOT"
+ fi
+fi
live:/*.[Ii][Mm][Gg] | /*.[Ii][Mm][Gg])
[ -f "${root#live:}" ] && rootok=1
;;
+ live:nfs*)
+ rootok=1
+ ;;
esac
[ "$rootok" = "1" ] || return 1
client_test "NFSv3 root=dhcp DHCP proto:IP:path,options" 52:54:00:12:34:07 \
"root=dhcp" 192.168.50.3 wsize=4096 || return 1
+ client_test "NFSv3 Overlayfs root=nfs:..." 52:54:00:12:34:04 \
+ "root=nfs:192.168.50.1:/nfs/client rd.live.image rd.live.overlay.overlayfs=1" \
+ 192.168.50.1 -wsize=4096 || return 1
+
return 0
}
# Make client's dracut image
"$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
-o "plymouth dash ${OMIT_NETWORK}" \
- -a "debug watchdog ${USE_NETWORK}" \
+ -a "dmsquash-live debug watchdog ${USE_NETWORK}" \
--no-hostonly-cmdline -N \
-f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1