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