staging-v0.3.5: Added is_debian_live() and disabled manual partitioning

This commit is contained in:
frisco 2009-06-27 06:09:15 +00:00
parent 1d1139428b
commit cccc883b49
2 changed files with 49 additions and 2 deletions

View file

@ -29,14 +29,15 @@
<p><input type="checkbox" name="confirm" value="1" id="confirm" /><label for="confirm"><?cs var:html_escape(Lang.Plugins.partition.Text.Confirm) ?></label></p> <p><input type="checkbox" name="confirm" value="1" id="confirm" /><label for="confirm"><?cs var:html_escape(Lang.Plugins.partition.Text.Confirm) ?></label></p>
<p><input type="hidden" name="device" value="<?cs var:Data.CurrentDisk.device ?>" /> <p><input type="hidden" name="device" value="<?cs var:Data.CurrentDisk.device ?>" />
<?cs call:show_help(Lang.Plugins.partition.Help.PartMode) ?> <!--Manual partitioning disabled for Release 0.3.5 -->
<!--<?cs call:show_help(Lang.Plugins.partition.Help.PartMode) ?>-->
<div align="center"><table><tr> <div align="center"><table><tr>
<!-- we have to avoid an ugly IE bug, that ignores the "value" attribute <!-- we have to avoid an ugly IE bug, that ignores the "value" attribute
of "button" elements: if a variable called 'easy' is set, then this of "button" elements: if a variable called 'easy' is set, then this
button was choosen - uuuuuugly! --> button was choosen - uuuuuugly! -->
<td><input class="button" type="submit" name="easy" value="<?cs var:html_escape(Lang.Plugins.partition.Button.EasySetup) ?>" /></td> <td><input class="button" type="submit" name="easy" value="<?cs var:html_escape(Lang.Plugins.partition.Button.EasySetup) ?>" /></td>
<td><input class="button" type="submit" name="add_part" value="<?cs var:html_escape(Lang.Plugins.partition.Button.SelectDevice) ?>" /></td> <td><!--This button commented out for CryptoNAS 0.3.5 release <input class="button" type="submit" name="add_part" value="<?cs var:html_escape(Lang.Plugins.partition.Button.SelectDevice) ?>" /> --></td>
</tr></table></div> </tr></table></div>
</form> </form>

View file

@ -211,6 +211,10 @@ class Blockdevice:
## extended partition, unused loop device ## extended partition, unused loop device
CACHE.set(cache_link, False) CACHE.set(cache_link, False)
return 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? ## are we the device mapper of a luks device?
for slave in self.slaves: for slave in self.slaves:
if get_blockdevice(slave, self.sysblock_dir, if get_blockdevice(slave, self.sysblock_dir,
@ -238,6 +242,48 @@ class Blockdevice:
else: else:
return False 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): def is_lvm_pv(self):
"""return if the device is a physical volume of a LVM """return if the device is a physical volume of a LVM