[SCM] live-boot branch, debian-next, updated. debian/3.0_a5-1-3-g82839c0
Marco Amadori
amadorim at vdavda.com
Mon Sep 13 15:37:50 UTC 2010
The following commit has been merged in the debian-next branch:
commit 02f20a9427be1c8a0092fb0e0c1f5ac195ffde4a
Author: Marco Amadori <amadorim at vdavda.com>
Date: Tue Sep 7 17:38:27 2010 +0200
Fix snapshots' sync-strings usage (Closes: #591330).
Signed-off-by: Marco Amadori <amadorim at vdavda.com>
diff --git a/bin/live-snapshot b/bin/live-snapshot
index 08e5fd6..991e704 100755
--- a/bin/live-snapshot
+++ b/bin/live-snapshot
@@ -7,7 +7,7 @@
# for reuse in another live-boot session.
# Look at the manpage for more informations.
#
-# Copyright (C) 2006-2008 Marco Amadori <marco.amadori at gmail.com>
+# Copyright (C) 2006-2010 Marco Amadori <marco.amadori at gmail.com>
# Copyright (C) 2008 Chris Lamb <chris at chris-lamb.co.uk>
#
# This program is free software: you can redistribute it and/or modify
@@ -39,7 +39,7 @@ fi
. /usr/share/initramfs-tools/scripts/live-helpers
-LIVE_CONF="/etc/live.conf"
+LIVE_CONF="/etc/live/boot.d/snapshot.conf"
if [ -r "${LIVE_CONF}" ]
then
@@ -242,7 +242,7 @@ Defaults ()
# Parse resync string
if [ -n "${SNAP_RESYNC_STRING}" ]
then
- SNAP_COW=$(echo "${SNAP_RESYNC_STRING}" | sed -e 's|^/root\([^:.]*\).*$|'"${DEF_SNAP_COW}"'\1|')
+ SNAP_COW=$(echo "${SNAP_RESYNC_STRING}" | sed -r -e 's#^([^:]*).*$#'"${DEF_SNAP_COW}"'\1#')
SNAP_DEV=$(echo "${SNAP_RESYNC_STRING}" | cut -f2 -d ':')
SNAP_MNT=$(echo "${SNAP_RESYNC_STRING}" | cut -f3 -d ':')
DEST="${MOUNTP}/${SNAP_MNT}"
diff --git a/debian/live-boot.init b/debian/live-boot.init
index 03bc390..b93cfcd 100644
--- a/debian/live-boot.init
+++ b/debian/live-boot.init
@@ -21,12 +21,13 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
NAME=live-boot
SCRIPTNAME=/etc/init.d/${NAME}
DO_SNAPSHOT=/sbin/live-snapshot
+SNAPSHOT_CONF="/etc/live/boot.d/snapshot.conf"
# Exit if system was not booted by live-boot
grep -qs boot=live /proc/cmdline || exit 0
-# Read configuration variable file if it is present
-[ -r /etc/live.conf ] && . /etc/live.conf
+# Read snapshot configuration variables
+[ -r ${SNAPSHOT_CONF} ] && . ${SNAPSHOT_CONF}
# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS
diff --git a/scripts/live b/scripts/live
index d34279d..bef055a 100755
--- a/scripts/live
+++ b/scripts/live
@@ -1026,6 +1026,16 @@ try_snap ()
snapdata="${1}"
snap_mount="${2}"
snap_type="${3}"
+ snap_relpath="${4}"
+
+ if [ -z "${snap_relpath}" ]
+ then
+ # root snapshot, default usage
+ snap_relpath="/"
+ else
+ # relative snapshot (actually used just for "/home" snapshots)
+ snap_mount="${2}${snap_relpath}"
+ fi
if [ -n "${snapdata}" ] && [ ! -b "${snapdata}" ]
then
@@ -1106,11 +1116,11 @@ try_snap ()
fi
fi
else
- log_warning_msg "Impossible to include the ${snap_type} Snapshot"
+ log_warning_msg "Impossible to include the ${snap_type} Snapshot (o)"
return 1
fi
- echo "export ${snap_type}SNAP="/cow${snap_mount#$rootmnt}":${snapdev}:${snapfile}" >> /etc/live.conf # for resync on reboot/halt
+ echo "export ${snap_type}SNAP=${snap_relpath}:${snapdev}:${snapfile}" >> snapshot.conf # for resync on reboot/halt
return 0
}
@@ -1448,7 +1458,7 @@ setup_unionfs ()
# Look for other snapshots to copy in
try_snap "${root_snapdata}" "${rootmnt}" "ROOT"
# This second type should be removed when snapshot grow smarter
- try_snap "${home_snapdata}" "${rootmnt}/home" "HOME"
+ try_snap "${home_snapdata}" "${rootmnt}" "HOME" "/home"
fi
if [ -n "${SHOWMOUNTS}" ]
@@ -1857,6 +1867,18 @@ mountroot ()
# when booting FAI, this simple workaround solves it
ls /root/* >/dev/null 2>&1
+ # copy snapshot configuration if exists
+ if [ -f snapshot.conf ]
+ then
+ log_begin_msg "Copying snapshot.conf to ${rootmnt}/etc/live/boot.d"
+ if [ ! -d "${rootmnt}/etc/live/boot.d" ]
+ then
+ mkdir -p "${rootmnt}/etc/live/boot.d"
+ fi
+ cp snapshot.conf "${rootmnt}/etc/live/boot.d/"
+ log_end_msg
+ fi
+
maybe_break live-bottom
log_begin_msg "Running /scripts/live-bottom\n"
--
live-boot
More information about the debian-live-changes
mailing list