]> git.siccegge.de Git - forks/vmdebootstrap.git/commitdiff
Use grub-probe instead of blkid on freebsd
authorChristoph Egger <christoph@christoph-egger.org>
Sun, 1 Nov 2015 16:47:28 +0000 (17:47 +0100)
committerChristoph Egger <christoph@christoph-egger.org>
Sun, 1 Nov 2015 16:47:59 +0000 (17:47 +0100)
grub-probe can identify the ufsid to use

vmdebootstrap

index f5041cde93025de934a9c17422f4dfa24b3bdc5b..d166485ade83ab2a64028f46d57cd84c243bf9a4 100755 (executable)
@@ -700,17 +700,21 @@ class VmDebootstrap(cliapp.Application):  # pylint: disable=too-many-public-meth
 
     def create_fstab(self, rootdir, rootdev, roottype, bootdev, boottype):  # pylint: disable=too-many-arguments
         def fsuuid(device):
-            out = self.runcmd(['blkid', '-c', '/dev/null', '-o', 'value',
-                               '-s', 'UUID', device])
-            return out.splitlines()[0].strip()
+            if 'freebsd' in os.sys.platform:
+                out = self.runcmd(['grub-probe', '-d', device, '-t', 'fs_uuid'])
+                return "/dev/ufsid/%s" % out.strip()
+            else:
+                out = self.runcmd(['blkid', '-c', '/dev/null', '-o', 'value',
+                                '-s', 'UUID', device])
+                return "UUID=%s" % out.splitlines()[0].strip()
 
         if rootdev:
-            rootdevstr = 'UUID=%s' % fsuuid(rootdev)
+            rootdevstr = fsuuid(rootdev)
         else:
             rootdevstr = '/dev/sda1'
 
         if bootdev and not self.settings['use-uefi']:
-            bootdevstr = 'UUID=%s' % fsuuid(bootdev)
+            bootdevstr = fsuuid(bootdev)
         else:
             bootdevstr = None