diff --git a/staging-v0.3.5/src/cryptobox/core/blockdevice.py b/staging-v0.3.5/src/cryptobox/core/blockdevice.py
index d6efe06..677b83e 100644
--- a/staging-v0.3.5/src/cryptobox/core/blockdevice.py
+++ b/staging-v0.3.5/src/cryptobox/core/blockdevice.py
@@ -211,6 +211,10 @@ class Blockdevice:
## extended partition, unused loop device
CACHE.set(cache_link, False)
return False
+ if self.is_debian_live():
+ ##Don't try to write to Debian Live Media
+ CACHE.set(cache_link, False)
+ return False
## are we the device mapper of a luks device?
for slave in self.slaves:
if get_blockdevice(slave, self.sysblock_dir,
@@ -238,6 +242,48 @@ class Blockdevice:
else:
return False
+ def is_debian_live(self):
+ """is the device part of the Debian Live runtime
+ """
+ ##Debian Live ("iso" or "usb-hdd" versions) uses two block
+ ##devices as part of its runtime system. The raw boot media
+ ##(such as a usb key or cdrom) is mounted at /live_media,
+ ##and the root filesystem is mounted off of the live media
+ ##using /dev/loop0.
+ deb_live_devs = []
+ for line in file("/proc/mounts"):
+ try:
+ fields = line.split(" ")
+ ##We are looking for, for example:
+ ##/dev/hdc /live_media iso9660 ro 0 0
+ ##and
+ ##/dev/loop0 /filesystem.squashfs squashfs ro 0 0
+ if (fields[1] == "/live_media" and
+ fields[3] == "ro"):
+ deb_live_devs.append(fields[0])
+ elif (fields[1] == "/filesystem.squashfs" and
+ fields[3] == "ro"):
+ deb_live_devs.append(fields[0])
+ except IndexError:
+ pass
+
+ ##TODO:
+ ##Since the lines in /proc/mounts that affect deb_live_devs
+ ##don't change after startup, deb_live_devs could be cached here.
+ ##
+ ##Check whether any Debian Live devices refer to the
+ ##block device we were passed
+ matched = False
+ for dev in deb_live_devs:
+ for node in self.__get_device_nodes():
+ if (node == dev):
+ matched = True
+
+
+ ##If no nodes of the block device match the Debian Live
+ ##devices, return False
+ return matched
+
def is_lvm_pv(self):
"""return if the device is a physical volume of a LVM