Adding upstream version 2.0.5. upstream/2.0.5
authorDaniel Baumann <daniel@debian.org>
Tue, 14 Sep 2010 06:57:10 +0000 (08:57 +0200)
committerDaniel Baumann <daniel@debian.org>
Tue, 14 Sep 2010 06:57:10 +0000 (08:57 +0200)
VERSION
bin/live-snapshot
manpages/de/live-boot.de.7
manpages/de/live-snapshot.de.1
manpages/en/live-boot.7
manpages/en/live-snapshot.1
manpages/po/de/live-boot.7.po
manpages/po/de/live-snapshot.1.po
manpages/pot/live-boot.7.pot
manpages/pot/live-snapshot.1.pot
scripts/live

diff --git a/VERSION b/VERSION
index 2165f8f..e010258 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.0.4
+2.0.5
index 08e5fd6..991e704 100755 (executable)
@@ -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@gmail.com>
+# Copyright (C) 2006-2010 Marco Amadori <marco.amadori@gmail.com>
 # Copyright (C) 2008 Chris Lamb <chris@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}"
index b85fa11..213da9b 100644 (file)
@@ -3,7 +3,7 @@
 .\" This file was generated with po4a. Translate the source file.
 .\"
 .\"*******************************************************************
-.TH LIVE\-BOOT 7 06.09.2010 2.0.4 "Debian Live Projekt"
+.TH LIVE\-BOOT 7 14.09.2010 2.0.5 "Debian Live Projekt"
 
 .SH NAME
 \fBlive\-boot\fP \- System Boot Skripte
index 9cfa66c..644181c 100644 (file)
@@ -3,7 +3,7 @@
 .\" This file was generated with po4a. Translate the source file.
 .\"
 .\"*******************************************************************
-.TH LIVE\-BOOT 1 06.09.2010 2.0.4 "Debian Live Projekt"
+.TH LIVE\-BOOT 1 14.09.2010 2.0.5 "Debian Live Projekt"
 
 .SH NAME
 \fBlive\-snapshot\fP \- simple script to ease persistence usage
index ddac943..acbd2d3 100644 (file)
@@ -1,4 +1,4 @@
-.TH LIVE\-BOOT 7 2010\-09\-06 2.0.4 "Debian Live Project"
+.TH LIVE\-BOOT 7 2010\-09\-14 2.0.5 "Debian Live Project"
 
 .SH NAME
 \fBlive\-boot\fR \- System Boot Scripts
index 0b59d19..190dfdc 100644 (file)
@@ -1,4 +1,4 @@
-.TH LIVE\-BOOT 1 2010\-09\-06 2.0.4 "Debian Live Project"
+.TH LIVE\-BOOT 1 2010\-09\-14 2.0.5 "Debian Live Project"
 
 .SH NAME
 \fBlive\-snapshot\fR \- simple script to ease persistence usage
index d398e25..52af825 100644 (file)
@@ -4,8 +4,8 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: live-boot 2.0.4\n"
-"POT-Creation-Date: 2010-09-06 15:21+0300\n"
+"Project-Id-Version: live-boot 2.0.5\n"
+"POT-Creation-Date: 2010-09-14 08:55+0300\n"
 "PO-Revision-Date: 2010-05-24 12:34+0300\n"
 "Last-Translator: Daniel Baumann <daniel@debian.org>\n"
 "Language-Team: none\n"
@@ -24,14 +24,14 @@ msgstr "LIVE-BOOT"
 #. type: TH
 #: en/live-boot.7:1 en/live-snapshot.1:1
 #, no-wrap
-msgid "2010-09-06"
-msgstr "06.09.2010"
+msgid "2010-09-14"
+msgstr "14.09.2010"
 
 #. type: TH
 #: en/live-boot.7:1 en/live-snapshot.1:1
 #, no-wrap
-msgid "2.0.4"
-msgstr "2.0.4"
+msgid "2.0.5"
+msgstr "2.0.5"
 
 #. type: TH
 #: en/live-boot.7:1 en/live-snapshot.1:1
index 5f19b71..a827d81 100644 (file)
@@ -4,8 +4,8 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: live-boot 2.0.4\n"
-"POT-Creation-Date: 2010-09-06 15:21+0300\n"
+"Project-Id-Version: live-boot 2.0.5\n"
+"POT-Creation-Date: 2010-09-14 08:55+0300\n"
 "PO-Revision-Date: 2010-05-24 12:34+0300\n"
 "Last-Translator: Daniel Baumann <daniel@debian.org>\n"
 "Language-Team: none\n"
@@ -24,14 +24,14 @@ msgstr "LIVE-BOOT"
 #. type: TH
 #: en/live-boot.7:1 en/live-snapshot.1:1
 #, no-wrap
-msgid "2010-09-06"
-msgstr "06.09.2010"
+msgid "2010-09-14"
+msgstr "14.09.2010"
 
 #. type: TH
 #: en/live-boot.7:1 en/live-snapshot.1:1
 #, no-wrap
-msgid "2.0.4"
-msgstr "2.0.4"
+msgid "2.0.5"
+msgstr "2.0.5"
 
 #. type: TH
 #: en/live-boot.7:1 en/live-snapshot.1:1
index 89ce500..ebc0770 100644 (file)
@@ -7,7 +7,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: live-boot VERSION\n"
-"POT-Creation-Date: 2010-09-06 15:21+0300\n"
+"POT-Creation-Date: 2010-09-14 08:55+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -25,13 +25,13 @@ msgstr ""
 #. type: TH
 #: en/live-boot.7:1 en/live-snapshot.1:1
 #, no-wrap
-msgid "2010-09-06"
+msgid "2010-09-14"
 msgstr ""
 
 #. type: TH
 #: en/live-boot.7:1 en/live-snapshot.1:1
 #, no-wrap
-msgid "2.0.4"
+msgid "2.0.5"
 msgstr ""
 
 #. type: TH
index d018ff4..06fbd2c 100644 (file)
@@ -7,7 +7,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: live-boot VERSION\n"
-"POT-Creation-Date: 2010-09-06 15:21+0300\n"
+"POT-Creation-Date: 2010-09-14 08:55+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -25,13 +25,13 @@ msgstr ""
 #. type: TH
 #: en/live-boot.7:1 en/live-snapshot.1:1
 #, no-wrap
-msgid "2010-09-06"
+msgid "2010-09-14"
 msgstr ""
 
 #. type: TH
 #: en/live-boot.7:1 en/live-snapshot.1:1
 #, no-wrap
-msgid "2.0.4"
+msgid "2.0.5"
 msgstr ""
 
 #. type: TH
index 60a2c33..0e1b2f4 100755 (executable)
@@ -896,6 +896,8 @@ do_snap_copy ()
 
        if [ -b "${fromdev}" ]
        then
+               log_success_msg "Copying snapshot ${fromdev} to ${todir}..."
+
                # look for free mem
                if [ -n "${HOMEMOUNTED}" -a "${snap_type}" = "HOME" ]
                then
@@ -933,9 +935,8 @@ do_snap_copy ()
 
                return 0
        else
-               return 1
-
                log_warning_msg "Unable to find the snapshot ${snap_type} medium"
+               return 1
        fi
 }
 
@@ -965,6 +966,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
@@ -1002,8 +1013,16 @@ try_snap ()
                                cpioargs='--unconditional --make-directories'
                        fi
 
-                       cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | $cpiopath $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse 2>/dev/null
-                       RES="$?"
+                       if [ -s "${snapback}/${snapfile}" ]
+                       then
+                               BEFOREDIR="$(pwd)"
+                               cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | $cpiopath $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse 2>/dev/null
+                               RES="$?"
+                               cd "${BEFOREDIR}"
+                       else
+                               log_warning_msg "${snapback}/${snapfile} is empty, adding it for sync on reboot."
+                               RES="0"
+                       fi
 
                        if [ "${RES}" != "0" ]
                        then
@@ -1035,7 +1054,7 @@ try_snap ()
 
                if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
                then
-                       log_warning_msg "Impossible to include the ${snap_type} Snapshot"
+                       log_warning_msg "Impossible to include the ${snap_type} Snapshot (i)"
                        return 1
                else
                        if [ -n "${snapfile}" ]
@@ -1045,11 +1064,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
 }
 
@@ -1387,7 +1406,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}" ]
@@ -1796,6 +1815,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"