]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
livenet: Enable OverlayFS overlay in sysroot.mount generator.
authorFrederick Grose <fgrose@sugarlabs.org>
Wed, 1 Aug 2018 22:40:20 +0000 (18:40 -0400)
committerHarald Hoyer <harald@hoyer.xyz>
Mon, 20 Aug 2018 08:08:43 +0000 (10:08 +0200)
Adjust sysroot.mount configuration for rd.live.overlay.overlayfs option.
Use link at /dev/root as a consistent flag for wait_for_dev.
Adjust documentation.

dracut.cmdline.7.asc
modules.d/90dmsquash-live/dmsquash-live-root.sh
modules.d/90dmsquash-live/parse-dmsquash-live.sh
modules.d/90livenet/livenet-generator.sh

index 9252d253b21a5a9e23d626056e399b18f17f9926..df633e5d1f0ea310968a07a2ad685127b2a037ee 100644 (file)
@@ -930,7 +930,8 @@ 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 dracut 'livenet' module.
+Valid handlers: __http, https, ftp, torrent, tftp__.
 +
 [listing]
 .Example
@@ -955,7 +956,7 @@ By default, this is __squashfs.img__.
 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.
 
-**rd.live.overlay=**__<devspec>__:__(<pathspec>|auto)__|__none__::
+**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
@@ -1005,10 +1006,10 @@ 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.
-
++
 If a persistent overlay is detected at the standard LiveOS path, the overlay &
 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
 been implemented through the multiple lower layers feature of OverlayFS.
index 8f3b2bf99336a12082a063d77f1486a14e4e22de..ac6034081d764904929efc35399e85125b40da20 100755 (executable)
@@ -376,19 +376,20 @@ if [ -n "$overlayfs" ]; then
         mount -r $FSIMG /run/rootfsbase
     fi
     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' \
         "$NEWROOT" > $hookdir/mount/01-$$-live.sh
     fi
+    _dev=/run/rootfsbase
 else
-    ln -s /dev/mapper/live-rw /dev/root
+    _dev=/dev/mapper/live-rw
     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
+ln -s $_dev /dev/root
 
 need_shutdown
 
index a9b78ab5591cc0a8319f564eed3ea31897c5bb92..0eedf1f66025ca6fa95d4977602b9e204f248e2e 100755 (executable)
@@ -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
index a349cd0b6ee80f3809ef9cbc8b16e52ee0800888..e2b5b6ebf817455387240f6b20ad2842291675d0 100755 (executable)
@@ -43,19 +43,29 @@ GENERATOR_DIR="$2"
 
 [ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
 
+getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
+[ -e /xor_overlayfs ] && xor_overlayfs="yes"
 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"
+        echo "Options=${ROOTFLAGS},lowerdir=/run/rootfsbase,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"