def start_installation(self):
        # Alongside method shrinks selected partition
        # and creates root and swap partition in the available space
        
        if self.is_room_available() == False:
            return

        partition_path = self.row[0]
        otherOS = self.row[1]
        fs_type = self.row[2]

        # what if path is sda10 (two digits) ? this is wrong
        device_path = self.row[0][:-1]

        #re.search(r'\d+$', self.row[0])

        new_size = self.new_size
        
        # first, shrink file system
        res = fs.resize(partition_path, fs_type, new_size)
        if res:
            # destroy original partition and create a new resized one
            pm.split_partition(device_path, partition_path, new_size)
        else:
            logging.error("Can't shrink %s(%s) filesystem" % (otherOS, fs_type))
            return
        
            
        
        '''
Пример #2
0
    def start_installation(self):
        # Alongside method shrinks selected partition
        # and creates root and swap partition in the available space

        partition_path = self.row[0]
        otherOS = self.row[1]
        fs_type = self.row[2]

        # what if path is sda10 (two digits) ? this is wrong
        device_path = self.row[0][:-1]

        new_size = self.new_size

        print("partition_path: ", partition_path)
        print("device_path: ", device_path)
        print("new_size: ", new_size)

        # Find out how many primary partitions device has, and also
        # if there's already an extended partition

        extended_path = ""
        primary_partitions = []

        for path in self.partitions:
            if device_path in path:
                p = self.partitions[path]
                if p.type == pm.PARTITION_EXTENDED:
                    extended_path = path
                elif p.type == pm.PARTITION_PRIMARY:
                    primary_partitions.append(path)

        primary_partitions.sort()

        print("extended partition: ", extended_path)
        print("primary partitions: ", primary_partitions)

        # If we don't have 3 or 4 primary partitions,
        # we will be able to create a new one
        if len(primary_partitions) < 3:
            # first, shrink file system
            res = fs.resize(partition_path, fs_type, new_size)
            if res:
                # destroy original partition and create two new ones
                pm.split_partition(device_path, partition_path, new_size)
            else:
                print("Can't shrink %s(%s) filesystem" % (otherOS, fs_type))
        else:
            print(
                "There're too many primary partitions, can't create a new one")
        '''
        # Prepare info for installer_process
        mount_devices = {}
        mount_devices["/"] =
        mount_devices["swap"] = 
        
        root = mount_devices["/"]
        swap = mount_devices["swap"]
        
        fs_devices = {}
        fs_devices[root] = "ext4"
        fs_devices[swap] = "swap"
        fs_devices[partition_path] = self.row[2]
        '''
        '''        
Пример #3
0
    def start_installation(self):
        # Alongside method shrinks selected partition
        # and creates root and swap partition in the available space
        
        partition_path = self.row[0]
        otherOS = self.row[1]
        fs_type = self.row[2]

        # what if path is sda10 (two digits) ? this is wrong
        device_path = self.row[0][:-1]

        new_size = self.new_size
        
        print("partition_path: ", partition_path)
        print("device_path: ", device_path)
        print("new_size: ", new_size)
        
        # Find out how many primary partitions device has, and also
        # if there's already an extended partition

        extended_path = ""
        primary_partitions = []
        
        for path in self.partitions:
            if device_path in path:
                p = self.partitions[path]
                if p.type == pm.PARTITION_EXTENDED:
                    extended_path = path
                elif p.type == pm.PARTITION_PRIMARY:
                    primary_partitions.append(path)
        
        primary_partitions.sort()
        
        print("extended partition: ", extended_path)
        print("primary partitions: ", primary_partitions)
        
        # If we don't have 3 or 4 primary partitions,
        # we will be able to create a new one
        if len(primary_partitions) < 3:
            # first, shrink file system
            res = fs.resize(partition_path, fs_type, new_size)
            if res:
                # destroy original partition and create two new ones
                pm.split_partition(device_path, partition_path, new_size)
            else:
                print("Can't shrink %s(%s) filesystem" % (otherOS, fs_type))
        else:
            print("There're too many primary partitions, can't create a new one")
            

        '''
        # Prepare info for installer_process
        mount_devices = {}
        mount_devices["/"] =
        mount_devices["swap"] = 
        
        root = mount_devices["/"]
        swap = mount_devices["swap"]
        
        fs_devices = {}
        fs_devices[root] = "ext4"
        fs_devices[swap] = "swap"
        fs_devices[partition_path] = self.row[2]
        '''




        '''