Patch for initramfs-tools (Was Re: process/procedure for fixes)

Paul Albrecht albrecht at rdi1.com
Tue Aug 5 03:04:13 UTC 2008


On Monday 04 August 2008 20:17:54 Ben Collins wrote:
> On Mon, 2008-08-04 at 19:42 -0500, Paul Albrecht wrote:
> > Here's the patch again:
>
> A little better, but it's now a problem where it's line wrapping. I can
> read it at least (but it wont apply without manually fixing it up).
>

Here's the patch again without word wrap:

diff -Naur initramfs-tools-0.85eubuntu36.pristine/init initramfs-tools-0.85eubuntu36.hacked/init
--- initramfs-tools-0.85eubuntu36.pristine/init 2008-04-09 09:45:23.000000000 -0500
+++ initramfs-tools-0.85eubuntu36.hacked/init   2008-08-04 09:51:31.000000000 -0500
@@ -125,6 +125,15 @@
                debug=y
                set -x
                ;;
+        snapdev=*)
+                SNAPDEV=${x#snapdev=}
+                ;;
+        snapfstype=*)
+                SNAPFSTYPE=${x#snapfstype=}
+                ;;
+       aufs)
+               AUFS=y
+               ;;
        break=*)
                break=${x#break=}
                ;;
diff -Naur initramfs-tools-0.85eubuntu36.pristine/scripts/local initramfs-tools-0.85eubuntu36.hacked/scripts/local
--- initramfs-tools-0.85eubuntu36.pristine/scripts/local        2008-04-09 09:18:14.000000000 -0500
+++ initramfs-tools-0.85eubuntu36.hacked/scripts/local  2008-08-04 11:30:01.000000000 -0500
@@ -107,6 +107,20 @@
                # FIXME This has no error checking
                mount ${roflag} -o loop -t ${FSTYPE} ${LOOPFLAGS} "/host/${LOOP#/}" ${rootmnt}

+               # Optionally remount the loop device with a copy-on-write layer
+                if [ "$SNAPDEV" ] ; then
+                        mkdir -p /snap
+                        mount -n -t ${SNAPFSTYPE} ${SNAPDEV} /snap
+                       if [ "$AUFS" = "y" ] ; then
+                               mount -n -t aufs -o br:/snap=rw:${rootmnt}=ro none ${rootmnt}
+                       else
+                               mount -n -t unionfs -o dirs=/snap=rw:${rootmnt}=ro unionfs ${rootmnt}
+                       fi
+                        if [ -d ${rootmnt}/snap ]; then
+                                mount -o move /snap ${rootmnt}/snap
+                        fi
+                fi
+
                if [ -d ${rootmnt}/host ]; then
                        mount -o move /host ${rootmnt}/host
                fi

-- 
Paul Albrecht


More information about the kernel-team mailing list