|
|
|
@ -1211,11 +1211,11 @@ class PartitionDistributive(Distributive):
|
|
|
|
|
if not format in self.format_map:
|
|
|
|
|
raise DistributiveError(
|
|
|
|
|
_("The specified format of '%s' is not supported") % format)
|
|
|
|
|
if dev in map(lambda y: y.split(" ")[0],
|
|
|
|
|
filter(lambda x: x.startswith("/"),
|
|
|
|
|
open("/proc/swaps"))):
|
|
|
|
|
raise DistributiveError(
|
|
|
|
|
_("Failed to format %s: this partition is used as swap") % dev)
|
|
|
|
|
with open("/proc/swaps") as f:
|
|
|
|
|
if dev in map(lambda y: y.split(" ")[0],
|
|
|
|
|
filter(lambda x: x.startswith("/"),f)):
|
|
|
|
|
raise DistributiveError(
|
|
|
|
|
_("Failed to format %s: this partition is used as swap") % dev)
|
|
|
|
|
self._checkMount(dev)
|
|
|
|
|
if not os.access(dev, os.W_OK):
|
|
|
|
|
raise DistributiveError(_("Failed to format the partition") +
|
|
|
|
@ -1289,12 +1289,13 @@ class PartitionDistributive(Distributive):
|
|
|
|
|
|
|
|
|
|
def formatSwapPartition(self, dev):
|
|
|
|
|
"""Format swap partition"""
|
|
|
|
|
if dev in map(lambda y: y.split(" ")[0],
|
|
|
|
|
filter(lambda x: x.startswith("/"),
|
|
|
|
|
open("/proc/swaps"))):
|
|
|
|
|
raise DistributiveError(
|
|
|
|
|
_("Failed to execute 'mkswap %s': the swap partition is used "
|
|
|
|
|
"by the current system") % dev)
|
|
|
|
|
with open("/proc/swaps") as f:
|
|
|
|
|
if dev in map(lambda y: y.split(" ")[0],
|
|
|
|
|
filter(lambda x: x.startswith("/"),f)):
|
|
|
|
|
raise DistributiveError(
|
|
|
|
|
_("Failed to execute 'mkswap %s': "
|
|
|
|
|
"the swap partition is used "
|
|
|
|
|
"by the current system") % dev)
|
|
|
|
|
if isMount(dev):
|
|
|
|
|
raise DistributiveError(
|
|
|
|
|
_("Failed to format %s: this partition is mounted") % dev)
|
|
|
|
|