Merging casper 1.178.
authorDaniel Baumann <daniel@debian.org>
Fri, 30 Apr 2010 15:44:27 +0000 (17:44 +0200)
committerDaniel Baumann <daniel@debian.org>
Wed, 9 Mar 2011 16:48:08 +0000 (17:48 +0100)
docs/ChangeLog.casper
scripts/live

index 5457e52..533fd20 100644 (file)
@@ -1,3 +1,24 @@
+casper (1.178) karmic; urgency=low
+
+  * Ensure that unionfs-fuse isn't killed by /etc/init.d/sendsigs on
+    shutdown (LP: #386010).
+  * Patches from "phl" (https://launchpad.net/~ubuntu-leledy), adjusted by
+    me, to fix snapshot resync:
+    - Avoid using cpio -u -d options if klibc cpio is in use (LP: #384059).
+    - Copy /etc/casper.conf into /root, otherwise we forget snapshot resync
+      settings (LP: #384061).
+    - Adjust the first field of *SNAP entries in casper.conf to be relative
+      to /cow, not /root (LP: #384066).
+    - Prefix $DEST with $MOUNTP in casper-snapshot (LP: #384068).
+    - /etc/init.d/casper is usually called with 'start', so handle that as
+      well as 'stop' to do snapshot resyncing and CD ejecting (LP: #384076).
+  * Fix casper-snapshot(1) syntax to avoid missing spaces between options
+    and their values.
+  * Fix showmounts when used in conjunction with unionfs-fuse; read-only
+    filesystems need to be bind-mounted rather than move-mounted.
+
+ -- Colin Watson <cjwatson@ubuntu.com>  Fri, 12 Jun 2009 13:24:28 +0100
+
 casper (1.177) karmic; urgency=low
 
   * Port from Debian (thanks, Daniel Baumann):
index 3000d78..21c3d99 100755 (executable)
@@ -1081,14 +1081,23 @@ try_snap ()
                        RES=$?
                else
                        # cpio.gz snapshot
-                       cd "${snap_mount}"
-                       zcat "${snapback}/${snapfile}" | /bin/cpio --extract --preserve-modification-time --no-absolute-filenames --sparse --unconditional --make-directories > /dev/null 2>&1
-                       RES=$?
-                       if [ "${RES}" != "0" ]
+
+                       # Unfortunately klibc's cpio is incompatible with the
+                       # rest of the world; everything else requires -u -d,
+                       # while klibc doesn't implement them. Try to detect
+                       # whether it's in use.
+                       cpiopath="$(which cpio)" || true
+                       if [ "$cpiopath" ] && grep -aq /lib/klibc "$cpiopath"
+                       then
+                               cpioargs=
+                       else
+                               cpioargs='--unconditional --make-directories'
+                       fi
+
+                       if ! (cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | cpio $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse 2>/dev/null)
                        then
-                               log_warning_msg "failure to \"zcat ${snapback}/${snapfile} | /bin/cpio --extract --preserve-modification-time --no-absolute-filenames --sparse --unconditional --make-directories\""
+                               log_warning_msg "failure to \"zcat ${snapback}/${snapfile} | cpio $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse\""
                        fi
-                       cd "${OLDPWD}"
                fi
 
                umount "${snapback}" ||  log_warning_msg "failure to \"umount ${snapback}\""
@@ -1129,7 +1138,7 @@ try_snap ()
                return 1
        fi
 
-       echo "export ${snap_type}SNAP="${snap_mount}":${snapdev}:${snapfile}" >> /etc/live.conf # for resync on reboot/halt
+       echo "export ${snap_type}SNAP="/cow${snap_mount#$rootmnt}":${snapdev}:${snapfile}" >> /etc/live.conf # for resync on reboot/halt
        return 0
 }
 
@@ -1419,6 +1428,8 @@ setup_unionfs ()
                        case "${UNIONTYPE}" in
                                unionfs-fuse)
                                        (ulimit -n 16384; unionfs-fuse -o cow -o noinitgroups -o default_permissions -o allow_other -o use_ino -o suid /cow=RW:${exposedrootfs}${dir} "${rootmnt}${dir}" || panic "mount ${UNIONTYPE} on ${rootmnt}${dir} failed with option cow,noinitgroups,default_permissions,allow_other,use_ino,suid=/cow=RW:${exposedrootfs}${dir}")
+                                       mkdir -p /dev/.initramfs/varrun
+                                       pidof unionfs-fuse >> /dev/.initramfs/varrun/sendsigs.omit || true
                                        ;;
 
                                *)
@@ -1430,6 +1441,8 @@ setup_unionfs ()
                case "${UNIONTYPE}" in
                        unionfs-fuse)
                                (ulimit -n 16384; unionfs-fuse -o cow -o noinitgroups -o default_permissions -o allow_other -o use_ino -o suid /cow=RW:${rofsstring} "${rootmnt}" || panic "mount ${UNIONTYPE} on ${rootmnt} failed with option cow,noinitgroups,default_permissions,allow_other,use_ino,suid=/cow:RW:${rofsstring}")
+                               mkdir -p /dev/.initramfs/varrun
+                               pidof unionfs-fuse >> /dev/.initramfs/varrun/sendsigs.omit || true
                                ;;
 
                        *)
@@ -1860,4 +1873,8 @@ mountroot ()
        exec 2>&7 7>&-
        kill ${tailpid}
        [ -w "${rootmnt}/var/log/" ] && cp live.log "${rootmnt}/var/log/" 2>/dev/null
+       if [ -f /etc/live.conf ]
+       then
+               cp /etc/live.conf "${rootmnt}/etc/"
+       fi
 }