当前位置: 首页>>代码示例>>Python>>正文


Python GLIUtility.spawn方法代码示例

本文整理汇总了Python中GLIUtility.spawn方法的典型用法代码示例。如果您正苦于以下问题:Python GLIUtility.spawn方法的具体用法?Python GLIUtility.spawn怎么用?Python GLIUtility.spawn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GLIUtility的用法示例。


在下文中一共展示了GLIUtility.spawn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_deps

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def get_deps(self, pkgs):
		pkglist = []
		if isinstance(pkgs, str):
			pkgs = pkgs.split()
		for pkg in pkgs:
			if not pkg: continue
			if self._debug: self._logger.log("get_deps(): pkg is " + pkg)
			if not self._grp_install or not self.get_best_version_vdb(pkg):
				if self._debug: self._logger.log("get_deps(): grabbing compile deps")
				tmppkglist = GLIUtility.spawn("emerge -p " + pkg + r" 2>/dev/null | grep -e '^\[[a-z]' | cut -d ']' -f2 | sed -e 's:^ ::' -e 's: .\+$::'", chroot=self._chroot_dir, return_output=True)[1].strip().split("\n")
			else:
				if self._debug: self._logger.log("get_deps(): grabbing binary deps")
				# The runtimedeps.py script generates a package install order that is *very* different from emerge itself
#				tmppkglist = GLIUtility.spawn("python ../../runtimedeps.py " + self._chroot_dir + " " + pkg, return_output=True)[1].strip().split("\n")
				tmppkglist = []
				for tmppkg in GLIUtility.spawn("emerge -p " + pkg + r" 2>/dev/null | grep -e '^\[[a-z]' | cut -d ']' -f2 | sed -e 's:^ ::' -e 's: .\+$::'", chroot=self._chroot_dir, return_output=True)[1].strip().split("\n"):
					if self._debug: self._logger.log("get_deps(): looking at " + tmppkg)
					if self.get_best_version_vdb("=" + tmppkg):
						if self._debug: self._logger.log("get_deps(): package " + tmppkg + " in host vdb...adding to tmppkglist")
						tmppkglist.append(tmppkg)
			if self._debug: self._logger.log("get_deps(): deplist for " + pkg + ": " + str(tmppkglist))
			for tmppkg in tmppkglist:
				if self._debug: self._logger.log("get_deps(): checking to see if " + tmppkg + " is already in pkglist")
				if not tmppkg in pkglist and not self.get_best_version_vdb_chroot("=" + tmppkg):
					if self._debug: self._logger.log("get_deps(): adding " + tmppkg + " to pkglist")
					pkglist.append(tmppkg)
		if self._debug: self._logger.log("get_deps(): pkglist is " + str(pkglist))
		return pkglist
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:30,代码来源:GLIPortage.py

示例2: add_pkg_to_world

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def add_pkg_to_world(self, package):
		if package.find("/") == -1:
			package = self.get_best_version_vdb_chroot(package)
		if not package: return False
		expr = re.compile('^=?(.+?/.+?)(-\d.+)?$')
		res = expr.match(package)
		if res:
			GLIUtility.spawn("echo " + res.group(1) + " >> " + self._chroot_dir + "/var/lib/portage/world")
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:10,代码来源:GLIPortage.py

示例3: _configure_lilo

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def _configure_lilo(self):
		self.build_mode = self._install_profile.get_kernel_build_method()
		self._gather_lilo_drive_info()
		root = self._chroot_dir
		file_name3 = root + "/boot/kernel_name"
		root = self._chroot_dir
		exitstatus0 = GLIUtility.spawn("ls "+root+"/boot/kernel-* > "+file_name3)
		if (exitstatus0 != 0):
			raise GLIException("BootloaderError", 'fatal', '_configure_lilo', "Could not list kernels in /boot or no kernels found.")
		if self.build_mode == "genkernel" or self._install_profile.get_kernel_source_pkg() == "livecd-kernel":
			exitstatus1 = GLIUtility.spawn("ls "+root+"/boot/init* >> "+file_name3)
			if (exitstatus1 != 0):
				raise GLIException("BootloaderError", 'fatal', '_configure_lilo', "Could not list initrds in /boot")
		g = open(file_name3)
		kernel_name = g.readlines()
		g.close()
		if not kernel_name[0]:
			raise GLIException("BootloaderError", 'fatal', '_configure_lilo',"Error: We have no kernel in /boot to put in the grub.conf file!")
		kernel_name = map(string.strip, kernel_name)
		kernel_name[0] = kernel_name[0].split(root)[1]
		kernel_name[1] = kernel_name[1].split(root)[1]
		if self._install_profile.get_bootloader_kernel_args(): bootloader_kernel_args = self._install_profile.get_bootloader_kernel_args()
		else: bootloader_kernel_args = ""
		#-------------------------------------------------------------
		#time to build the lilo.conf
		newliloconf = ""
		if self._install_profile.get_boot_loader_mbr():
			newliloconf += "boot="+self.mbr_device+"   # Install LILO in the MBR \n"
		else:
			newliloconf += "boot="+self.boot_device+self.boot_minor+"   # Install LILO in the MBR \n"
		newliloconf += "prompt                    # Give the user the chance to select another section\n"
		newliloconf += "timeout=50                # Wait 5 (five) seconds before booting the default section\n"
		newliloconf += "default=gentoo            # When the timeout has passed, boot the \"gentoo\" section\n"
		newliloconf += "# Only if you use framebuffer. Otherwise remove the following line:\n"
		if not self._install_profile.get_kernel_bootsplash():
			newliloconf += "#"
		newliloconf += "vga=788                   # Framebuffer setting. Adjust to your own will\n"
		newliloconf += "image=/boot"+kernel_name[0][5:]+" \n"
		newliloconf += "  label=gentoo \n  read-only \n"
		if self.build_mode != "genkernel" and self._install_profile.get_kernel_source_pkg() != "livecd-kernel": 
			newliloconf += "  root="+self.root_device+self.root_minor+" \n"
			if bootloader_kernel_args:
				newliloconf += "  append=\""+bootloader_kernel_args+"\" \n"
		else:
			newliloconf += "  root=/dev/ram0 \n"
			newliloconf += "  append=\"init=/linuxrc ramdisk=8192 real_root="+self.root_device+self.root_minor + " " + bootloader_kernel_args + "\" \n"
			newliloconf += "  initrd=/boot"+kernel_name[1][5:] + "\n\n"
		newliloconf = self._lilo_add_windows(newliloconf)
		#now make the lilo.conf file
		file_name = root + "/etc/lilo.conf"	
		try:
			shutil.move(file_name, file_name + ".OLDdefault")
		except:
			pass
		f = open(file_name, 'w')
		f.writelines(newliloconf)
		f.close()
		self._logger.log("Lilo installed and configured.  Not run yet.")
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:60,代码来源:x86ArchitectureTemplate.py

示例4: _partition_resize_step

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def _partition_resize_step(self, parted_disk, device, oldparts, newparts):
		for oldpart in oldparts:
			tmppart_old = oldparts[oldpart]
			devnode = tmppart_old['devnode']
			newminor = self._find_existing_in_new(oldpart, newparts)
			if not newminor or not newparts[newminor]['resized']:
				continue
			tmppart_new = newparts[newminor]
			type = tmppart_new['type']
			start = tmppart_new['start']
			end = start + (long(tmppart['mb']) * MEGABYTE / 512) - 1
			total_sectors = end - start + 1
			total_bytes = long(total_sectors) * 512
			# Make sure calculated end sector doesn't overlap start sector of next partition
			nextminor = self._find_next_partition(newminor, newparts)
			if nextminor:
				if newparts[nextminor]['start'] and end >= newparts[nextminor]['start']:
					self._logger.log("  End sector for growing partition overlaps with start of next partition...fixing")
					end = newparts[nextminor]['start'] - 1
			# sleep a bit first
			time.sleep(3)
			# now sleep until it exists
			while not GLIUtility.is_file(device + str(minor)):
				self._logger.log("Waiting for device node " + devnode + " to exist before resizing")
				time.sleep(1)
			# one bit of extra sleep is needed, as there is a blip still
			time.sleep(3)
			if type in ("ext2", "ext3"):
				ret = GLIUtility.spawn("resize2fs " + devnode + " " + str(total_sectors) + "s", logfile=self._compile_logfile, append_log=True)
				if not GLIUtility.exitsuccess(ret): # Resize error
					raise GLIException("PartitionResizeError", 'fatal', 'partition', "could not resize ext2/3 filesystem on " + devnode)
			elif type == "ntfs":
				ret = GLIUtility.spawn("yes | ntfsresize -v --size " + str(total_bytes) + " " + devnode, logfile=self._compile_logfile, append_log=True)
				if not GLIUtility.exitsuccess(ret): # Resize error
					raise GLIException("PartitionResizeError", 'fatal', 'partition', "could not resize NTFS filesystem on " + devnode)
			elif type in ("linux-swap", "fat32", "fat16"):
				parted_fs = parted_disk.get_partition(part).geom.file_system_open()
				resize_constraint = parted_fs.get_resize_constraint()
				if total_sectors < resize_constraint.min_size or start != resize_constraint.start_range.start:
					raise GLIException("PartitionError", 'fatal', 'partition', "New size specified for " + device + str(minor) + " is not within allowed boundaries (blame parted)")
				new_geom = resize_constraint.start_range.duplicate()
				new_geom.set_start(start)
				new_geom.set_end(end)
				try:
					parted_fs.resize(new_geom)
				except:
					raise GLIException("PartitionResizeError", 'fatal', 'partition', "could not resize " + device + str(minor))
			self._logger.log("  Deleting old minor " + str(oldpart) + " to be recreated in 3rd pass")
			self._delete_partition(parted_disk, oldpart)
		parted_disk.delete_all()
		parted_disk.commit()
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:53,代码来源:x86ArchitectureTemplate.py

示例5: _setup_lilo

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def _setup_lilo(self):
		#-------------------------------------------------------------
		#OK, now that the file is built.  Install lilo.
		exitstatus = GLIUtility.spawn("/sbin/lilo",chroot=self._chroot_dir, logfile=self._compile_logfile, append_log=True)
		if exitstatus != 0:
			raise GLIException("LiloInstallError", 'fatal', '_setup_lilo', "Running lilo failed!")
		self._logger.log("Bootloader: lilo has been run/installed!")
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:9,代码来源:x86ArchitectureTemplate.py

示例6: _partition_format_step

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def _partition_format_step(self, parted_disk, device, newparts):
		for part in newparts:
			newpart = newparts[part]
			devnode = newpart['devnode']
			# This little hack is necessary because parted sucks goat nuts
			if newparts.get_disklabel() == "mac" and newpart['type'] == "free":
				self._delete_partition(parted_disk, newpart)
				continue
			if newpart['format'] and newpart['type'] not in ('extended', 'free'):
#				devnode = device + str(int(part))
				if self._debug: self._logger.log("_partition_format_step(): devnode is %s in formatting code" % devnode)
				# if you need a special command and
				# some base options, place it here.
				format_cmds = { 'linux-swap': "mkswap", 'fat16': "mkfs.vfat -F 16", 'fat32': "mkfs.vfat -F 32",
				                'ntfs': "mkntfs", 'xfs': "mkfs.xfs -f", 'jfs': "mkfs.jfs -f",
				                'reiserfs': "mkfs.reiserfs -f", 'ext2': "mkfs.ext2", 'ext3': "mkfs.ext3"
				              }
				if newpart['type'] in format_cmds:
					cmdname = format_cmds[newpart['type']]
				else: # this should catch everything else
					raise GLIException("PartitionFormatError", 'fatal', '_partition_format_step', "Unknown partition type " + newpart['type'])
				# sleep a bit first
				time.sleep(1)
				for tries in range(10):
					cmd = "%s %s %s" % (cmdname, newpart['mkfsopts'], devnode)
					self._logger.log("  Formatting partition %s as %s with: %s" % (str(part),newpart['type'],cmd))
					ret = GLIUtility.spawn(cmd, logfile=self._compile_logfile, append_log=True)
					if not GLIUtility.exitsuccess(ret):
						self._logger.log("Try %d failed formatting partition %s...waiting 5 seconds" % (tries+1, devnode))
						time.sleep(5)
					else:
						break
				else:
					raise GLIException("PartitionFormatError", 'fatal', '_partition_format_step', "Could not create %s filesystem on %s" % (newpart['type'], devnode))
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:36,代码来源:x86ArchitectureTemplate.py

示例7: set_partitions_from_disk

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def set_partitions_from_disk(self):
		parted_part = self._parted_disk.next_partition()
		while parted_part:
			part_mb = long((parted_part.geom.end - parted_part.geom.start + 1) * self._sector_bytes / MEGABYTE)
			# Ignore metadata "partitions"...this will need to be changed for non-x86
			if parted_part.num >= 1:
				fs_type = ""
				if parted_part.fs_type != None: fs_type = parted_part.fs_type.name
				if parted_part.type == 2: fs_type = "extended"
				part_name = ""
				if self._parted_disk.type.check_feature(parted.DISK_TYPE_PARTITION_NAME):
					part_name = parted_part.get_name()
				self._partitions.append(Partition(self, parted_part.num, part_mb, parted_part.geom.start, parted_part.geom.end, fs_type, format=False, existing=True, name=part_name))
			elif parted_part.type_name == "free":
				if self._disklabel == "mac":
					free_minor = int(GLIUtility.spawn("mac-fdisk -l %s | grep '@ %s' | cut -d ' ' -f 1" % (self._device, str(parted_part.geom.start)), return_output=True)[1].strip()[-1])
				elif self.get_extended_partition() and parted_part.geom.start >= self.get_partition(self.get_extended_partition()).get_start() and parted_part.geom.end <= self.get_partition(self.get_extended_partition()).get_end():
					if self._partitions[-1].get_minor() > 4:
						free_minor = self._partitions[-1].get_minor() + FREE_MINOR_FRAC_LOG
					else:
						free_minor = 4 + FREE_MINOR_FRAC_LOG
				else:
					try:
						free_minor = self._partitions[-1].get_minor() + FREE_MINOR_FRAC_PRI
					except IndexError:
						free_minor = FREE_MINOR_FRAC_PRI
				self._partitions.append(Partition(self, free_minor, part_mb, parted_part.geom.start, parted_part.geom.end, "free", format=False, existing=False))
			parted_part = self._parted_disk.next_partition(parted_part)
		# Juggle minor numbers so they match physical disk order. People may complain, but we're actually doing them a favor
		self.reorder_minors()
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:32,代码来源:GLIStorageDevice.py

示例8: start_portmap

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def start_portmap(self):
		if self._configuration.get_verbose(): self._logger.log("DEBUG: beginning of start_portmap()")
		status = GLIUtility.spawn('/etc/init.d/portmap start') #, display_on_tty8=True)
		if not GLIUtility.exitsuccess(status):
			self._logger.log("ERROR! : Could not start the portmap service!")
		#	raise GLIException("PortmapError", 'warning', 'start_portmap', "Could not start the portmap service!")
		else:
			self._logger.log("Portmap started.")
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:10,代码来源:GLIClientController.py

示例9: enable_ssh

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def enable_ssh(self):
		if self._configuration.get_verbose(): self._logger.log("DEBUG: beginning of enable_ssh()")
		if self._configuration.get_enable_ssh():
			status = GLIUtility.spawn("/etc/init.d/sshd start")
			if not GLIUtility.exitsuccess(status):
				self._logger.log("ERROR! : Could not start the SSH daemon!")
			#	raise GLIException("SSHError", 'warning','enable_ssh',"Could not start SSH daemon!")
			else:
				self._logger.log("SSH Started.")
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:11,代码来源:GLIClientController.py

示例10: get_best_version_vdb_chroot

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def get_best_version_vdb_chroot(self, package):
		if package.startswith('='):
			package = package[1:]
			if GLIUtility.is_file(self._chroot_dir + "/var/db/pkg/" + package):
				return package
			else:
				return ""
		else:
			return GLIUtility.spawn("portageq best_version / " + package, chroot=self._chroot_dir, return_output=True)[1].strip()
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:11,代码来源:GLIPortage.py

示例11: set_root_passwd

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def set_root_passwd(self):
		self._logger.log("Setting root password.")
		if self._configuration.get_root_passwd() != "":
			# The password specified in the configuration is encrypted.
			status = GLIUtility.spawn("echo 'root:" + self._configuration.get_root_passwd() + "' | chpasswd -e")
	
			if not GLIUtility.exitsuccess(status):
				self._logger.log("ERROR! : Could not set the root password on the livecd environment!")
			#	raise GLIException("PasswordError", 'warning', 'set_root_passwd', "Could not set the root password!")
			else:
				self._logger.log("Livecd root password set.")
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:13,代码来源:GLIClientController.py

示例12: load_kernel_modules

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def load_kernel_modules(self):
		if self._configuration.get_verbose(): self._logger.log("DEBUG: beginning of load_kernel_modules()")
		modules = self._configuration.get_kernel_modules()
		if self._configuration.get_verbose(): self._logger.log("DEBUG: load_kernel_modules(): modules are " + str(modules))
		for module in modules:
			try:
				if self._configuration.get_verbose(): self._logger.log("DEBUG: load_kernel_modules(): trying to load module " + module)
				ret = GLIUtility.spawn('modprobe ' + module)
				if not GLIUtility.exitsuccess(ret):
					self._logger.log("ERROR! : Could not load module: "+module)
				#	raise GLIException("KernelModuleError", 'warning', 'load_kernel_modules', 'Could not load module: ' + module)
				else:
					self._logger.log('kernel module: ' + module + ' loaded.')
			except KernelModuleError, error:
				self.output(error)
				self._logger.log(error.get_error_level() + '! ' + error.get_error_msg())
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:18,代码来源:GLIClientController.py

示例13: _setup_grub

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def _setup_grub(self):
		#-------------------------------------------------------------
		#OK, now that the file is built.  Install grub.
		#cp /proc/mounts /etc/mtab
		#grub-install --root-directory=/boot /dev/hda
		#shutil.copy("/proc/mounts",root +"/etc/mtab")
		self._gather_grub_drive_info()
		grubinstallstring = "echo -en 'root ("+self.grub_boot_drive + "," + self.grub_boot_minor + ")\n"
		if not self._install_profile.get_boot_loader_mbr():
			grubinstallstring +="setup ("+self.grub_boot_drive + "," + self.grub_boot_minor + ")\n"
		else:
			grubinstallstring +="setup ("+self.grub_mbr_drive+")\n"
		grubinstallstring += "quit\n' | "+self._chroot_dir+"/sbin/grub --batch --no-floppy"
		if self._debug: self._logger.log("DEBUG: _configure_grub(): Grub install string: " + grubinstallstring)
		exitstatus = GLIUtility.spawn(grubinstallstring, logfile=self._compile_logfile, append_log=True)
		if not GLIUtility.exitsuccess(exitstatus):
			raise GLIException("GrubInstallError", 'fatal', '_setup_grub', "Could not install grub!")
		self._logger.log("Bootloader: grub has been installed!")
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:20,代码来源:x86ArchitectureTemplate.py

示例14: _map_device_to_grub_device

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def _map_device_to_grub_device(self, device):
		file_name = self._chroot_dir + "/boot/grub/glidevice.map"
		#If we can't find it, make it.  If we STILL can't find it. die.
		if not GLIUtility.is_file(file_name):
			exitstatus1 = GLIUtility.spawn("echo quit | "+ self._chroot_dir+"/sbin/grub --batch --no-floppy --device-map="+file_name, logfile=self._compile_logfile, append_log=True)
		if not GLIUtility.is_file(file_name):
			raise GLIException("BootloaderError", 'fatal', '_configure_grub', "Error making the new device map.")
		"""
		read the device map.  sample looks like this:
		(fd0)   /dev/floppy/0
		(hd0)   /dev/sda
		(hd1)   /dev/hda
		(hd2)   /dev/hdb
		"""
		
		# Search for the key
		f = open(file_name)  #open the device map
		file = f.readlines()
		f.close()	
		for i in range(len(file)):
			if file[i][6:-1] == device:
				return file[i][1:4]
		raise GLIException("BootloaderError", 'fatal', '_map_device_to_grub_device', "ERROR, could not map"+device+" to anything in the device map")
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:25,代码来源:x86ArchitectureTemplate.py

示例15: do_recommended

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import spawn [as 别名]
	def do_recommended(self):
		free_minor = 0
		recommended_parts = [ { 'type': "ext2", 'size': 100, 'mountpoint': "/boot" },
                              { 'type': "linux-swap", 'size': 512, 'mountpoint': "" },
                              { 'type': "ext3", 'size': "*", 'mountpoint': "/" } ]
		to_create = []
		physical_memory = int(GLIUtility.spawn(r"free -m | egrep '^Mem:' | sed -e 's/^Mem: \+//' -e 's/ \+.\+$//'", return_output=True)[1].strip())
#		parts = self.get_ordered_partition_list()
		# Search for concurrent unallocated space >=4GB
		for part in self._partitions:
			if part.get_type() == "free" and part.get_mb() >= 4096:
				free_minor = part.get_minor()
				break
		if not free_minor:
			raise GLIException("RecommendedPartitionLayoutError", "notice", "do_recommended", "You do not have atleast 4GB of concurrent unallocated space. Please remove some partitions and try again.")
		remaining_free = self.get_partition(free_minor).get_mb()
		for newpart in recommended_parts:
			# extended/logical partitions suck like a hoover
			if self._labelinfo['extended'] and free_minor == (3 + FREE_MINOR_FRAC_PRI) and not newpart == recommended_parts[-1]:
				if self.get_extended_partition():
					raise GLIException("RecommendedPartitionLayoutError", "notice", "do_recommended", "This code is not yet robust enough to handle automatic partitioning with your current layout.")
				to_create.append({ 'type': "extended", 'size': remaining_free, 'mountpoint': "", 'free_minor': free_minor })
				free_minor = 4 + FREE_MINOR_FRAC_LOG
			newpart['free_minor'] = free_minor
			# Small hack to calculate optimal swap partition size
			if newpart['type'] == "linux-swap" and physical_memory and physical_memory < 1024:
				newpart['size'] = physical_memory * 2
			to_create.append(newpart)
			free_minor = free_minor + 1
			if not newpart['size'] == "*":
				remaining_free = remaining_free - newpart['size']
		for newpart in to_create:
			if newpart['size'] == "*":
				# This doesn't seem quite right...it should probably be set to remaining_free
#				newpart['size'] = self.get_partition(newpart['free_minor']).get_mb()
				newpart['size'] = remaining_free
			self.add_partition(newpart['free_minor'], newpart['size'], 0, 0, newpart['type'], mountpoint=newpart['mountpoint'])
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:39,代码来源:GLIStorageDevice.py


注:本文中的GLIUtility.spawn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。