[SCM] Debian Live initramfs hook branch, master, updated. 1.157.2-1-7-g8bee5d0

Daniel Baumann daniel at debian.org
Fri May 15 20:33:00 UTC 2009


The following commit has been merged in the master branch:
commit 8bee5d07f32c8895102e4f20128366d4a771cbfb
Author: Marco Amadori <amadorim at vdavda.com>
Date:   Fri May 15 18:05:08 2009 +0200

    Cleaned a bit the snapshot feature.
    
    * home-sn are working both cpio and full partition, changed how
      live-snapshot.list works in home-sn case.
    
    Signed-off-by: Marco Amadori <amadorim at vdavda.com>

diff --git a/bin/live-snapshot b/bin/live-snapshot
index d70ef36..bf63041 100755
--- a/bin/live-snapshot
+++ b/bin/live-snapshot
@@ -238,7 +238,7 @@ Defaults ()
 	# Parse resync string
 	if [ -n "${SNAP_RESYNC_STRING}" ]
 	then
-		SNAP_COW=$(echo "${SNAP_RESYNC_STRING}" | cut -f1 -d ':')
+		SNAP_COW=$(echo "${SNAP_RESYNC_STRING/\/root/${DEF_SNAP_COW}}" | cut -f1 -d ':')
 		SNAP_DEV=$(echo "${SNAP_RESYNC_STRING}" | cut -f2 -d ':')
 		SNAP_MNT=$(echo "${SNAP_RESYNC_STRING}" | cut -f3 -d ':')
 		DEST="${MOUNTP}/${SNAP_MNT}"
@@ -346,7 +346,7 @@ Entry_is_modified ()
 
 	if [ -e "${entry}" ] || [ -L "${entry}" ]
 	then
-		if [ -e "${DEF_SNAP_COW}/${entry}" ] || [ -L "${DEF_SNAP_COW}/${entry}" ]
+		if [ -e "${SNAP_COW}/${entry}" ] || [ -L "${SNAP_COW}/${entry}" ]
 		then
 			return 0
 		fi
@@ -356,17 +356,25 @@ Entry_is_modified ()
 
 Do_filelist ()
 {
-	# BUGS: supports only cpio.gz types, and does not handle deleted files yet
-
+	# BUGS: does not handle deleted files yet
 	TMP_FILELIST=$1
+
 	if [ -f "${SNAP_LIST}" ]
 	then
+		# if SNAP_COW == /live/cow/home, SNAP_RW = /home
+		SNAP_RW="${SNAP_COW/${DEF_SNAP_COW}}"
+		if [ -z "${SNAP_RW}" ]
+		then
+			SNAP_RW="/"
+		fi
+
+		cd "${SNAP_RW}"
 		# Generate include list removing empty and commented lines
-		for entry in $(sed -e '/^ *$/d' -e '/^#.*$/d' "${SNAP_LIST}")
+		# and transforming paths to relatives
+		for entry in $(sed -e '/^ *$/d' -e '/^#.*$/d' -e 's#^.*$#./&#' -e 's#/\+#/#g' "${SNAP_LIST}")
 		do
 			if [ -d "${entry}" ]
 			then
-				cd /
 				find "${entry}" | while read line
 				do
 					if Entry_is_modified "${line}"
@@ -374,26 +382,22 @@ Do_filelist ()
 						printf "%s\000" "${line}" >> "${TMP_FILELIST}"
 					fi
 				done
-				cd "${OLDPWD}"
 			elif Entry_is_modified "${entry}"
 			then
 				# if file exists and it is modified
 				printf "%s\000" "${entry}" >> "${TMP_FILELIST}"
 			fi
 		done
+		cd "${OLDPWD}"
 
-		if [ "${SNAP_COW}" = "${DEF_SNAP_COW}" ]
-		then
-			# Relative to rootfs
-			echo "/"
-		else
-			# Mostly "/home"
-			echo "${SNAP_COW}"
-		fi
+		# echo Working dir
+		echo "${SNAP_RW}"
 	else
 		cd "${SNAP_COW}"
+		# removing whiteouts from list
 		find . -path '*.wh.*' -prune -o -print0 >> "${TMP_FILELIST}"
 		cd "${OLDPWD}"
+		# echo Working dir
 		echo "${SNAP_COW}"
 	fi
 }
diff --git a/conf/live-snapshot.list b/conf/live-snapshot.list
index 30fe29d..db05733 100644
--- a/conf/live-snapshot.list
+++ b/conf/live-snapshot.list
@@ -5,6 +5,8 @@
 #
 # The syntax for the line is just a full file or directory pathname.
 # Those files and directories, and only those will be included on automatic persistence handling.
+#
+# Note that in home-sn snapshot all those paths are treated as relative to /home
 
 # Include itself for reuse
 /etc/live-snapshot.list
diff --git a/manpages/live-snapshot.en.1.txt b/manpages/live-snapshot.en.1.txt
index 4ead532..4f53e7e 100644
--- a/manpages/live-snapshot.en.1.txt
+++ b/manpages/live-snapshot.en.1.txt
@@ -82,12 +82,12 @@ Files
 
   /etc/live-snapshot.list
 
-This optional file, if present changes the behaviour of live-snapshot, only files and directories listed there are included (integrally) in the snapshot. It works only for cpio targets.
+This optional file, if present changes the behaviour of live-snapshot, only files and directories listed there are included (integrally) in the snapshot. It works only for cpio and whole partition targets.
 
   /etc/live-snapshot.exclude_list
 
 This optional file, if present will filter the files that will be saved by live-snapshot removing (as in "grep -F -v") all filenames that will be matched by strings listed in it.
-It works for cpio and squashfs snapshot types only; it is pretty useful for filtering temporary files and disk caches.
+It works for cpio, whole partition and squashfs snapshot types only; it is pretty useful for filtering temporary files and disk caches.
 
 
 See also
diff --git a/manpages/live-snapshot.it.1.txt b/manpages/live-snapshot.it.1.txt
index dc8a992..1beb791 100644
--- a/manpages/live-snapshot.it.1.txt
+++ b/manpages/live-snapshot.it.1.txt
@@ -89,12 +89,12 @@ Files
   /etc/live-snapshot.list
 
 Facoltativo, se presente cambia completamente il funzionamento di live-snapshot; solo i files e le directory elencate verranno effettivamente inclusi nello snapshot.
-Funziona attualmente solo con gli snapshot di tipo "cpio".
+Funziona attualmente solo con gli snapshot di tipo "cpio" e "partizione intera".
 
   /etc/live-snapshot.exclude_list
 
 Facoltativo, se presente verrà utilizzato per filtrare i file da includere negli snapshot. Tutte i file che conterranno le stringhe elecate (come "grep -F -v") non verranno salvati da live-snapshot.
-Funziona attualmente solo con gli snapshot di tipo "cpio" e "squashfs"; è utile per filtrare contenuti poco significativi come i file temporanei e la cache.
+Funziona attualmente solo con gli snapshot di tipo "cpio", "partizione intera" e "squashfs"; è utile per filtrare contenuti poco significativi come i file temporanei e la cache.
 
 See also
 --------

-- 
Debian Live initramfs hook



More information about the debian-live-changes mailing list