|
Harald Hoyer |
fe31f8 |
From 579f3853848634ac5ecad1c8b2449f92446e2b84 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
fe31f8 |
From: Frederick Grose <fgrose@sugarlabs.org>
|
|
Harald Hoyer |
fe31f8 |
Date: Sun, 27 Jan 2013 14:47:17 -0500
|
|
Harald Hoyer |
fe31f8 |
Subject: [PATCH] Provide devices to enable booting with
|
|
Harald Hoyer |
fe31f8 |
rd.live.overlay.readonly=1
|
|
Harald Hoyer |
fe31f8 |
|
|
Harald Hoyer |
fe31f8 |
---
|
|
Harald Hoyer |
fe31f8 |
modules.d/90dmsquash-live/dmsquash-live-root.sh | 24 ++++++++++++++++++++----
|
|
Harald Hoyer |
fe31f8 |
1 file changed, 20 insertions(+), 4 deletions(-)
|
|
Harald Hoyer |
fe31f8 |
|
|
Harald Hoyer |
fe31f8 |
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh
|
|
Harald Hoyer |
fe31f8 |
index f302d44..0b1ed20 100755
|
|
Harald Hoyer |
fe31f8 |
--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
|
|
Harald Hoyer |
fe31f8 |
+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
|
|
Harald Hoyer |
fe31f8 |
@@ -110,18 +110,34 @@ do_live_overlay() {
|
|
Harald Hoyer |
fe31f8 |
umount -l /run/initramfs/overlayfs || :
|
|
Harald Hoyer |
fe31f8 |
fi
|
|
Harald Hoyer |
fe31f8 |
|
|
Harald Hoyer |
fe31f8 |
- if [ -z "$setup" ]; then
|
|
Harald Hoyer |
fe31f8 |
- if [ -n "$devspec" -a -n "$pathspec" ]; then
|
|
Harald Hoyer |
fe31f8 |
+ if [ -z "$setup" -o -n "$readonly_overlay" ]; then
|
|
Harald Hoyer |
fe31f8 |
+ if [ -n "$setup" ]; then
|
|
Harald Hoyer |
fe31f8 |
+ warn "Using temporary overlay."
|
|
Harald Hoyer |
fe31f8 |
+ elif [ -n "$devspec" -a -n "$pathspec" ]; then
|
|
Harald Hoyer |
fe31f8 |
warn "Unable to find persistent overlay; using temporary"
|
|
Harald Hoyer |
fe31f8 |
sleep 5
|
|
Harald Hoyer |
fe31f8 |
fi
|
|
Harald Hoyer |
fe31f8 |
|
|
Harald Hoyer |
fe31f8 |
dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((512*1024)) 2> /dev/null
|
|
Harald Hoyer |
fe31f8 |
- losetup $OVERLAY_LOOPDEV /overlay
|
|
Harald Hoyer |
fe31f8 |
+ if [ -n "$setup" -a -n "$readonly_overlay" ]; then
|
|
Harald Hoyer |
fe31f8 |
+ RO_OVERLAY_LOOPDEV=$( losetup -f )
|
|
Harald Hoyer |
fe31f8 |
+ losetup $RO_OVERLAY_LOOPDEV /overlay
|
|
Harald Hoyer |
fe31f8 |
+ else
|
|
Harald Hoyer |
fe31f8 |
+ losetup $OVERLAY_LOOPDEV /overlay
|
|
Harald Hoyer |
fe31f8 |
+ fi
|
|
Harald Hoyer |
fe31f8 |
fi
|
|
Harald Hoyer |
fe31f8 |
|
|
Harald Hoyer |
fe31f8 |
# set up the snapshot
|
|
Harald Hoyer |
fe31f8 |
- echo 0 `blockdev --getsz $BASE_LOOPDEV` snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create $readonly_overlay live-rw
|
|
Harald Hoyer |
fe31f8 |
+ sz=$(blockdev --getsz $BASE_LOOPDEV)
|
|
Harald Hoyer |
fe31f8 |
+ if [ -n "$readonly_overlay" ]; then
|
|
Harald Hoyer |
fe31f8 |
+ echo 0 $sz snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create $readonly_overlay live-ro
|
|
Harald Hoyer |
fe31f8 |
+ base="/dev/mapper/live-ro"
|
|
Harald Hoyer |
fe31f8 |
+ over=$RO_OVERLAY_LOOPDEV
|
|
Harald Hoyer |
fe31f8 |
+ else
|
|
Harald Hoyer |
fe31f8 |
+ base=$BASE_LOOPDEV
|
|
Harald Hoyer |
fe31f8 |
+ over=$OVERLAY_LOOPDEV
|
|
Harald Hoyer |
fe31f8 |
+ fi
|
|
Harald Hoyer |
fe31f8 |
+ echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
|
|
Harald Hoyer |
fe31f8 |
}
|
|
Harald Hoyer |
fe31f8 |
|
|
Harald Hoyer |
fe31f8 |
# live cd helper function
|