|
Harald Hoyer |
9d5d75 |
From e791d753bed41315cfbd8611e65cc8cd64ea2d15 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
9d5d75 |
From: Frederick Grose <fgrose@sugarlabs.org>
|
|
Harald Hoyer |
9d5d75 |
Date: Wed, 1 Aug 2018 18:40:20 -0400
|
|
Harald Hoyer |
9d5d75 |
Subject: [PATCH] livenet: Enable OverlayFS overlay in sysroot.mount generator.
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
Adjust sysroot.mount configuration for rd.live.overlay.overlayfs option.
|
|
Harald Hoyer |
9d5d75 |
Use link at /dev/root as a consistent flag for wait_for_dev.
|
|
Harald Hoyer |
9d5d75 |
Adjust documentation.
|
|
Harald Hoyer |
9d5d75 |
---
|
|
Harald Hoyer |
9d5d75 |
dracut.cmdline.7.asc | 9 +++++----
|
|
Harald Hoyer |
9d5d75 |
modules.d/90dmsquash-live/dmsquash-live-root.sh | 5 +++--
|
|
Harald Hoyer |
9d5d75 |
modules.d/90dmsquash-live/parse-dmsquash-live.sh | 2 +-
|
|
Harald Hoyer |
9d5d75 |
modules.d/90livenet/livenet-generator.sh | 18 ++++++++++++++----
|
|
Harald Hoyer |
9d5d75 |
4 files changed, 23 insertions(+), 11 deletions(-)
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
|
|
Harald Hoyer |
9d5d75 |
index 9252d253..df633e5d 100644
|
|
Harald Hoyer |
9d5d75 |
--- a/dracut.cmdline.7.asc
|
|
Harald Hoyer |
9d5d75 |
+++ b/dracut.cmdline.7.asc
|
|
Harald Hoyer |
9d5d75 |
@@ -930,7 +930,8 @@ NOTE: There must be enough free RAM available to hold the complete image.
|
|
Harald Hoyer |
9d5d75 |
This method is very suitable for diskless boots.
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
**root=**live:__<url>__::
|
|
Harald Hoyer |
9d5d75 |
-Boots a live image retrieved from __<url>__. Valid handlers: __http, https, ftp, torrent, tftp__.
|
|
Harald Hoyer |
9d5d75 |
+Boots a live image retrieved from __<url>__. Requires dracut 'livenet' module.
|
|
Harald Hoyer |
9d5d75 |
+Valid handlers: __http, https, ftp, torrent, tftp__.
|
|
Harald Hoyer |
9d5d75 |
+
|
|
Harald Hoyer |
9d5d75 |
[listing]
|
|
Harald Hoyer |
9d5d75 |
.Example
|
|
Harald Hoyer |
9d5d75 |
@@ -955,7 +956,7 @@ By default, this is __squashfs.img__.
|
|
Harald Hoyer |
9d5d75 |
Copy the complete image to RAM and use this for booting. This is useful
|
|
Harald Hoyer |
9d5d75 |
when the image resides on, i.e., a DVD which needs to be ejected later on.
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
-**rd.live.overlay=**__<devspec>__:__(<pathspec>|auto)__|__none__::
|
|
Harald Hoyer |
9d5d75 |
+**rd.live.overlay={**__<devspec>__[:__{<pathspec>|auto}__]|__none__}::
|
|
Harald Hoyer |
9d5d75 |
Allow the usage of a permanent overlay.
|
|
Harald Hoyer |
9d5d75 |
- _<devspec>_ specifies the path to a device with a mountable filesystem.
|
|
Harald Hoyer |
9d5d75 |
- _<pathspec>_ is the path to a file within that filesystem, which shall be
|
|
Harald Hoyer |
9d5d75 |
@@ -1005,10 +1006,10 @@ extended attributes and provides a valid d_type in readdir responses, such as
|
|
Harald Hoyer |
9d5d75 |
with ext4 and xfs. On non-vfat-formatted devices, a persistent OverlayFS
|
|
Harald Hoyer |
9d5d75 |
overlay can extend the available root filesystem storage up to the capacity of
|
|
Harald Hoyer |
9d5d75 |
the LiveOS device.
|
|
Harald Hoyer |
9d5d75 |
-
|
|
Harald Hoyer |
9d5d75 |
++
|
|
Harald Hoyer |
9d5d75 |
If a persistent overlay is detected at the standard LiveOS path, the overlay &
|
|
Harald Hoyer |
9d5d75 |
overlay type detected (whether OverlayFS or Device-mapper) will be used.
|
|
Harald Hoyer |
9d5d75 |
-
|
|
Harald Hoyer |
9d5d75 |
++
|
|
Harald Hoyer |
9d5d75 |
The **rd.live.overlay.readonly** option, which allows a persistent overlayfs to
|
|
Harald Hoyer |
9d5d75 |
be mounted read only through a higher level transient overlay directory, has
|
|
Harald Hoyer |
9d5d75 |
been implemented through the multiple lower layers feature of OverlayFS.
|
|
Harald Hoyer |
9d5d75 |
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh
|
|
Harald Hoyer |
9d5d75 |
index 8f3b2bf9..ac603408 100755
|
|
Harald Hoyer |
9d5d75 |
--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
|
|
Harald Hoyer |
9d5d75 |
+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
|
|
Harald Hoyer |
9d5d75 |
@@ -376,19 +376,20 @@ if [ -n "$overlayfs" ]; then
|
|
Harald Hoyer |
9d5d75 |
mount -r $FSIMG /run/rootfsbase
|
|
Harald Hoyer |
9d5d75 |
fi
|
|
Harald Hoyer |
9d5d75 |
if [ -z "$DRACUT_SYSTEMD" ]; then
|
|
Harald Hoyer |
9d5d75 |
- #FIXME What to link to /dev/root? Is it even needed?
|
|
Harald Hoyer |
9d5d75 |
printf 'mount -t overlay LiveOS_rootfs -o%s,%s %s\n' "$ROOTFLAGS" \
|
|
Harald Hoyer |
9d5d75 |
'lowerdir=/run/rootfsbase,upperdir=/run/overlayfs,workdir=/run/ovlwork' \
|
|
Harald Hoyer |
9d5d75 |
"$NEWROOT" > $hookdir/mount/01-$$-live.sh
|
|
Harald Hoyer |
9d5d75 |
fi
|
|
Harald Hoyer |
9d5d75 |
+ _dev=/run/rootfsbase
|
|
Harald Hoyer |
9d5d75 |
else
|
|
Harald Hoyer |
9d5d75 |
- ln -s /dev/mapper/live-rw /dev/root
|
|
Harald Hoyer |
9d5d75 |
+ _dev=/dev/mapper/live-rw
|
|
Harald Hoyer |
9d5d75 |
if [ -z "$DRACUT_SYSTEMD" ]; then
|
|
Harald Hoyer |
9d5d75 |
[ -n "$ROOTFLAGS" ] && ROOTFLAGS="-o $ROOTFLAGS"
|
|
Harald Hoyer |
9d5d75 |
printf 'mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh
|
|
Harald Hoyer |
9d5d75 |
fi
|
|
Harald Hoyer |
9d5d75 |
ln -s $BASE_LOOPDEV /run/rootfsbase
|
|
Harald Hoyer |
9d5d75 |
fi
|
|
Harald Hoyer |
9d5d75 |
+ln -s $_dev /dev/root
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
need_shutdown
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
diff --git a/modules.d/90dmsquash-live/parse-dmsquash-live.sh b/modules.d/90dmsquash-live/parse-dmsquash-live.sh
|
|
Harald Hoyer |
9d5d75 |
index a9b78ab5..0eedf1f6 100755
|
|
Harald Hoyer |
9d5d75 |
--- a/modules.d/90dmsquash-live/parse-dmsquash-live.sh
|
|
Harald Hoyer |
9d5d75 |
+++ b/modules.d/90dmsquash-live/parse-dmsquash-live.sh
|
|
Harald Hoyer |
9d5d75 |
@@ -57,6 +57,6 @@ info "root was $liveroot, is now $root"
|
|
Harald Hoyer |
9d5d75 |
# make sure that init doesn't complain
|
|
Harald Hoyer |
9d5d75 |
[ -z "$root" ] && root="live"
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
-wait_for_dev -n /run/rootfsbase
|
|
Harald Hoyer |
9d5d75 |
+wait_for_dev -n /dev/root
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
return 0
|
|
Harald Hoyer |
9d5d75 |
diff --git a/modules.d/90livenet/livenet-generator.sh b/modules.d/90livenet/livenet-generator.sh
|
|
Harald Hoyer |
9d5d75 |
index a349cd0b..e2b5b6eb 100755
|
|
Harald Hoyer |
9d5d75 |
--- a/modules.d/90livenet/livenet-generator.sh
|
|
Harald Hoyer |
9d5d75 |
+++ b/modules.d/90livenet/livenet-generator.sh
|
|
Harald Hoyer |
9d5d75 |
@@ -43,19 +43,29 @@ GENERATOR_DIR="$2"
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
+getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
|
|
Harald Hoyer |
9d5d75 |
+[ -e /xor_overlayfs ] && xor_overlayfs="yes"
|
|
Harald Hoyer |
9d5d75 |
ROOTFLAGS="$(getarg rootflags)"
|
|
Harald Hoyer |
9d5d75 |
{
|
|
Harald Hoyer |
9d5d75 |
echo "[Unit]"
|
|
Harald Hoyer |
9d5d75 |
echo "Before=initrd-root-fs.target"
|
|
Harald Hoyer |
9d5d75 |
echo "[Mount]"
|
|
Harald Hoyer |
9d5d75 |
echo "Where=/sysroot"
|
|
Harald Hoyer |
9d5d75 |
- echo "What=/dev/mapper/live-rw"
|
|
Harald Hoyer |
9d5d75 |
- [ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
|
|
Harald Hoyer |
9d5d75 |
+ if [ "$overlayfs$xor_overlayfs" = "yes" ]; then
|
|
Harald Hoyer |
9d5d75 |
+ echo "What=LiveOS_rootfs"
|
|
Harald Hoyer |
9d5d75 |
+ echo "Options=${ROOTFLAGS},lowerdir=/run/rootfsbase,upperdir=/run/overlayfs,workdir=/run/ovlwork"
|
|
Harald Hoyer |
9d5d75 |
+ echo "Type=overlay"
|
|
Harald Hoyer |
9d5d75 |
+ _dev=LiveOS_rootfs
|
|
Harald Hoyer |
9d5d75 |
+ else
|
|
Harald Hoyer |
9d5d75 |
+ echo "What=/dev/mapper/live-rw"
|
|
Harald Hoyer |
9d5d75 |
+ [ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
|
|
Harald Hoyer |
9d5d75 |
+ _dev=$'dev-mapper-live\\x2drw'
|
|
Harald Hoyer |
9d5d75 |
+ fi
|
|
Harald Hoyer |
9d5d75 |
} > "$GENERATOR_DIR"/sysroot.mount
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
-mkdir -p "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d"
|
|
Harald Hoyer |
9d5d75 |
+mkdir -p "$GENERATOR_DIR/$_dev.device.d"
|
|
Harald Hoyer |
9d5d75 |
{
|
|
Harald Hoyer |
9d5d75 |
echo "[Unit]"
|
|
Harald Hoyer |
9d5d75 |
echo "JobTimeoutSec=3000"
|
|
Harald Hoyer |
9d5d75 |
echo "JobRunningTimeoutSec=3000"
|
|
Harald Hoyer |
9d5d75 |
-} > "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d/timeout.conf"
|
|
Harald Hoyer |
9d5d75 |
+} > "$GENERATOR_DIR/$_dev.device.d/timeout.conf"
|
|
Harald Hoyer |
9d5d75 |
|