summaryrefslogtreecommitdiffstats
path: root/fsset.py
diff options
context:
space:
mode:
Diffstat (limited to 'fsset.py')
-rw-r--r--fsset.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/fsset.py b/fsset.py
index 3fbf5b69d..c0a83591e 100644
--- a/fsset.py
+++ b/fsset.py
@@ -1224,7 +1224,10 @@ class FileSystemSet:
sys.exit(0)
def labelEntry(self, entry, chroot):
- if entry.device.doLabel is not None:
+ label = entry.device.getLabel()
+ if label:
+ entry.setLabel(label)
+ elif entry.device.doLabel is not None:
entry.fsystem.labelDevice(entry, chroot)
def formatEntry(self, entry, chroot):
@@ -1629,6 +1632,12 @@ class Device:
def getName(self):
return self.__class__.__name__
+ def getLabel(self):
+ try:
+ return isys.readExt2Label(self.setupDevice(), makeDevNode = 0)
+ except:
+ return ""
+
class DevDevice(Device):
"""Device with a device node rooted in /dev that we just always use
the pre-created device node for."""