All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Frederick Grose <fgrose-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	livecd-TuqUDEhatI4ANWPb/1PvSmm0pvjS0E/A@public.gmane.org,
	spins-TuqUDEhatI4ANWPb/1PvSmm0pvjS0E/A@public.gmane.org
Subject: Re: [PATCH] Boot a Live USB device as read-only after persisting some changes.
Date: Wed, 14 Aug 2013 11:20:37 +0200	[thread overview]
Message-ID: <520B4BE5.6030003@redhat.com> (raw)
In-Reply-To: <CAEcBt+WE6RKc_QBSrn8WM_Q6tcrbxS8+ZoqXhQMXzyJ7gOuDyA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 08/12/2013 06:46 AM, Frederick Grose wrote:
> commit 96ff19a87c0be1eca27860aeef5434513b0e8c61
> Author: Frederick Grose <fgrose-agl9EP5VjmEgsBAKwltoeQ@public.gmane.org>
> Date:   Mon Aug 12 00:29:27 2013 -0400
> 
>     Allow read-only mounting of the base device filesystem, livedev.
>     Use read-only loop devices and non-persistent overlay targets.
> 
> diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh
> b/modules.d/90dmsquash-live/dmsquash-live-root.sh
> index 14e84e1..af0022f 100755
> --- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
> +++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
> @@ -24,7 +24,7 @@ squash_image=$(getarg rd.live.squashimg)
> 
>  getargbool 0 rd.live.ram -d -y live_ram && live_ram="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=""
> +getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay &&
> readonly_overlay="-r" || readonly_overlay=""
>  overlay=$(getarg rd.live.overlay -d overlay)
> 
>  # CD/DVD media check
> @@ -105,17 +105,23 @@ do_live_overlay() {
>      setup=""
>      if [ -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
>          mkdir -m 0755 /run/initramfs/overlayfs
> -        mount -n -t auto $devspec /run/initramfs/overlayfs || :
> -        if [ -f /run/initramfs/overlayfs$pathspec -a -w
> /run/initramfs/overlayfs$pathspec ]; then
> -            losetup $OVERLAY_LOOPDEV /run/initramfs/overlayfs$pathspec
> -            if [ -n "$reset_overlay" ]; then
> -                dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1
> conv=fsync 2>/dev/null
> +        mount -n -t auto -o $liverw $devspec /run/initramfs/overlayfs || :
> +        if [ -f /run/initramfs/overlayfs$pathspec ]; then
> +            if [ "$liverw" = ro ]; then
> +                readonly_overlay='-r'
> +            fi
> +            losetup $readonly_overlay $OVERLAY_LOOPDEV
> /run/initramfs/overlayfs$pathspec
> +            if [ -w /run/initramfs/overlayfs$pathspec ]; then
> +                if [ -n "$reset_overlay" ]; then
> +                    dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k
> count=1 conv=fsync 2>/dev/null
> +                fi
>              fi
>              setup="yes"
>          fi
>          umount -l /run/initramfs/overlayfs || :
>      fi
> 
> +    persistent='P'
>      if [ -z "$setup" -o -n "$readonly_overlay" ]; then
>          if [ -n "$setup" ]; then
>              warn "Using temporary overlay."
> @@ -123,6 +129,7 @@ do_live_overlay() {
>              warn "Unable to find persistent overlay; using temporary"
>              sleep 5
>          fi
> +        persistent='N'
> 
>          dd if=/dev/null of=/overlay bs=1024 count=1
> seek=$((512*1024)) 2> /dev/null
>          if [ -n "$setup" -a -n "$readonly_overlay" ]; then
> @@ -136,14 +143,14 @@ do_live_overlay() {
>      # set up the snapshot
>      sz=$(blockdev --getsz $BASE_LOOPDEV)
>      if [ -n "$readonly_overlay" ]; then
> -        echo 0 $sz snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 |
> dmsetup create $readonly_overlay live-ro
> +        echo 0 $sz snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV N 8 |
> dmsetup create $readonly_overlay live-ro
>          base="/dev/mapper/live-ro"
>          over=$RO_OVERLAY_LOOPDEV
>      else
>          base=$BASE_LOOPDEV
>          over=$OVERLAY_LOOPDEV
>      fi
> -    echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
> +    echo 0 $sz snapshot $base $over $persistent 8 | dmsetup create live-rw
>  }
> 
>  # live cd helper function
> @@ -217,7 +224,7 @@ fi
>  if [ -b "$OSMIN_LOOPDEV" ]; then
>      # set up the devicemapper snapshot device, which will merge
>      # the normal live fs image, and the delta, into a minimzied fs image
> -    echo "0 $( blockdev --getsz $BASE_LOOPDEV ) snapshot
> $BASE_LOOPDEV $OSMIN_LOOPDEV p 8" | dmsetup create --readonly
> live-osimg-min
> +    echo "0 $( blockdev --getsz $BASE_LOOPDEV ) snapshot
> $BASE_LOOPDEV $OSMIN_LOOPDEV N 8" | dmsetup create --readonly
> live-osimg-min
>  fi
> 
>  ROOTFLAGS="$(getarg rootflags)"

Care to resend the patch in a proper format? Your mailer seems to have wrapped
some lines.

  parent reply	other threads:[~2013-08-14  9:20 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 [this message]
     [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       ` [Fedora-livecd-list] " fgrose-Re5JQEeQqe8AvxtiuMwx3w

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=520B4BE5.6030003@redhat.com \
    --to=harald-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=fgrose-Re5JQEeQqe8AvxtiuMwx3w@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.