From: fgrose-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
livecd-TuqUDEhatI4ANWPb/1PvSmm0pvjS0E/A@public.gmane.org,
spins-TuqUDEhatI4ANWPb/1PvSmm0pvjS0E/A@public.gmane.org
Cc: Frederick Grose <fgrose-agl9EP5VjmEgsBAKwltoeQ@public.gmane.org>
Subject: Re: [Fedora-livecd-list] [PATCH] Boot a Live USB device as read-only after persisting some changes.
Date: Wed, 14 Aug 2013 16:42:39 -0400 [thread overview]
Message-ID: <1376512959-4806-1-git-send-email-fgrose@gmail.com> (raw)
In-Reply-To: <520B4BE5.6030003-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
From: Frederick Grose <fgrose@sugarlabs.org>
commit a6cd70fc9df2d299ed4f347461c33e4824df62f0
Author: Frederick Grose <fgrose@sugarlabs.org>
Enable read-only mounting of a persistent home.img filesystem.
Enable one to call for filesystem checking of home.img before
mounting on the next boot.
---
fedora-live-base.ks | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/fedora-live-base.ks b/fedora-live-base.ks
index 6c76e96..0512f67 100644
--- a/fedora-live-base.ks
+++ b/fedora-live-base.ks
@@ -116,9 +116,13 @@ mountPersistentHome() {
elif [ ! -b "\$homedev" ]; then
loopdev=\`losetup -f\`
if [ "\${homedev##/run/initramfs/live}" != "\${homedev}" ]; then
- action "Remounting live store r/w" mount -o remount,rw /run/initramfs/live
+ if [ "\$liverw" = rw ]; then
+ action "Remounting live store r/w" mount -o remount,rw /run/initramfs/live
+ else
+ opts="-r"
+ fi
fi
- losetup \$loopdev \$homedev
+ losetup \$opts \$loopdev \$homedev
homedev=\$loopdev
fi
@@ -130,6 +134,22 @@ mountPersistentHome() {
homedev=/dev/mapper/EncHome
fi
+ # If read-only is requested, prepare a non-persistent overlay and snapshot target.
+ if [ "\$opts" = "-r" ]; then
+ dd if=/dev/null of=/run/initramfs/overlayfs/home_overlay bs=1024 count=1 seek=\$((512*1024)) 2> /dev/null
+ HOME_OVERLAY_LOOPDEV=\$(losetup -f)
+ losetup \$HOME_OVERLAY_LOOPDEV /run/initramfs/overlayfs/home_overlay
+ sz=\$(blockdev --getsz \$homedev)
+ echo 0 \$sz snapshot \$homedev \$HOME_OVERLAY_LOOPDEV N 8 | dmsetup create home-rw
+ homedev=/dev/mapper/home-rw
+ fi
+
+ # Check the filesystem, if requested.
+ if [ -e /forcehomefsck ]; then
+ e2fsck -f -y -v \$homedev || e2fsck -f -y \$homedev
+ rm /forcehomefsck
+ fi
+
# and finally do the mount
mount \$mountopts \$homedev /home
# if we have /home under what's passed for persistent home, then
--
1.8.3.1
--
livecd mailing list
livecd@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/livecd
prev parent reply other threads:[~2013-08-14 20:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-12 4:46 [PATCH] Boot a Live USB device as read-only after persisting some changes Frederick Grose
[not found] ` <CAEcBt+WE6RKc_QBSrn8WM_Q6tcrbxS8+ZoqXhQMXzyJ7gOuDyA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-08-14 9:20 ` Harald Hoyer
[not found] ` <520B4BE5.6030003-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-08-14 20:38 ` fgrose-Re5JQEeQqe8AvxtiuMwx3w
[not found] ` <1376512685-4713-1-git-send-email-fgrose-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-16 8:20 ` Harald Hoyer
2013-08-14 20:42 ` fgrose-Re5JQEeQqe8AvxtiuMwx3w [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1376512959-4806-1-git-send-email-fgrose@gmail.com \
--to=fgrose-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=fgrose-agl9EP5VjmEgsBAKwltoeQ@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=livecd-TuqUDEhatI4ANWPb/1PvSmm0pvjS0E/A@public.gmane.org \
--cc=spins-TuqUDEhatI4ANWPb/1PvSmm0pvjS0E/A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.