Revision 71b0ab28 image_creator/os_type/freebsd.py

b/image_creator/os_type/freebsd.py
41 41
    def __init__(self, rootdev, ghandler, output):
42 42
        super(Freebsd, self).__init__(rootdev, ghandler, output)
43 43

  
44
    def _do_collect_metadata(self):
45

  
46
        super(Freebsd, self)._do_collect_metadata()
44 47
        self.meta["USERS"] = " ".join(self._get_passworded_users())
45 48

  
46 49
        #The original product name key is long and ugly
......
72 75

  
73 76
        return users
74 77

  
78
    def _do_mount(self, readonly):
79
        """Mount partitions in the correct order"""
80

  
81
        critical_mpoints = ('/', '/etc', '/root', '/home', '/var')
82

  
83
        # libguestfs can't handle correct freebsd partitions on GUID
84
        # Partition Table. We have to do the translation to linux
85
        # device names ourselves
86
        guid_device = re.compile('^/dev/((?:ada)|(?:vtbd))(\d+)p(\d+)$')
87

  
88
        mopts = "ufstype=ufs2,%s" % ('ro' if readonly else 'rw')
89
        for mp, dev in self._mountpoints():
90
            match = guid_device.match(dev)
91
            if match:
92
                m2 = int(match.group(2))
93
                m3 = int(match.group(3))
94
                dev = '/dev/sd%c%d' % (chr(ord('a') + m2), m3)
95
            try:
96
                self.g.mount_vfs(mopts, 'ufs', dev, mp)
97
            except RuntimeError as msg:
98
                if mp in critical_mpoints:
99
                    self.out.warn('unable to mount %s. Reason: %s' % (mp, msg))
100
                    return False
101
                else:
102
                    self.out.warn('%s (ignored)' % msg)
103

  
104
        return True
105

  
75 106
    @sysprep()
76 107
    def cleanup_password(self, print_header=True):
77 108
        """Remove all passwords and lock all user accounts"""

Also available in: Unified diff