Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 89683 | Differences between
and this patch

Collapse All | Expand All

(-)GLIArchitectureTemplate.py (-16 / +45 lines)
Lines 55-60 Link Here
55
                                 (self.set_timezone, "Setting timezone"),
55
                                 (self.set_timezone, "Setting timezone"),
56
                                 (self.emerge_kernel_sources, "Emerge kernel sources"),
56
                                 (self.emerge_kernel_sources, "Emerge kernel sources"),
57
                                 (self.build_kernel, "Building kernel"),
57
                                 (self.build_kernel, "Building kernel"),
58
                                 (self.install_kernel, "Installing a kernel"),
58
                                 (self.install_logging_daemon, "Logger"),
59
                                 (self.install_logging_daemon, "Logger"),
59
                                 (self.install_cron_daemon, "Cron daemon"),
60
                                 (self.install_cron_daemon, "Cron daemon"),
60
                                 (self.install_filesystem_tools, "Installing filesystem tools"),
61
                                 (self.install_filesystem_tools, "Installing filesystem tools"),
Lines 163-176 Link Here
163
					if not file[i][0] == '#':
164
					if not file[i][0] == '#':
164
						file[i] = '#' + file[i]
165
						file[i] = '#' + file[i]
165
	
166
	
166
			file.append('\n# Added by GLI\n')
167
			if key == "SPACER":
167
			commentprefix = ""
168
				file.append('\n')
168
			if newvalues[key] == "COMMENT" or newvalues[key] == "##comment##":
169
			elif key == "COMMENT" or key == "##comment##":
169
				commentprefix = "#"
170
				file.append('# ' + newvalues[key] + '\n')
170
			if quotes_around_value:
171
			elif quotes_around_value:
171
				file.append(commentprefix + key + delimeter + '"' + newvalues[key] + '"\n')
172
				file.append(key + delimeter + '"' + newvalues[key] + '"\n')
172
			else:
173
			else:
173
				file.append(commentprefix + key + delimeter + newvalues[key]+'\n')
174
				file.append(key + delimeter + newvalues[key]+'\n')
174
	
175
	
175
		f = open(filename,'w')
176
		f = open(filename,'w')
176
		f.writelines(file)
177
		f.writelines(file)
Lines 349-355 Link Here
349
	def configure_make_conf(self):
350
	def configure_make_conf(self):
350
		# Get make.conf options
351
		# Get make.conf options
351
		options = self._install_profile.get_make_conf()
352
		options = self._install_profile.get_make_conf()
352
		
353
354
		if options.keys():
355
			self._edit_config(self._chroot_dir + "/etc/make.conf", {"SPACER": ""})
356
			self._edit_config(self._chroot_dir + "/etc/make.conf", {"COMMENT": "GLI additions ===>"})
357
353
		# For each configuration option...
358
		# For each configuration option...
354
		for key in options.keys():
359
		for key in options.keys():
355
		
360
		
Lines 357-362 Link Here
357
			self._edit_config(self._chroot_dir + "/etc/make.conf", {key: options[key]})
362
			self._edit_config(self._chroot_dir + "/etc/make.conf", {key: options[key]})
358
		self._logger.log("Make.conf configured")
363
		self._logger.log("Make.conf configured")
359
364
365
		if options.keys():
366
			self._edit_config(self._chroot_dir + "/etc/make.conf", {"COMMENT": "<=== End GLI additions"})
367
360
	##
368
	##
361
	# This will get/update the portage tree.  If you want to snapshot or mount /usr/portage use "custom".
369
	# This will get/update the portage tree.  If you want to snapshot or mount /usr/portage use "custom".
362
	def install_portage_tree(self):
370
	def install_portage_tree(self):
Lines 446-451 Link Here
446
	##
454
	##
447
	# Fetches desired kernel sources, unless you're using a livecd-kernel in which case it does freaky stuff.
455
	# Fetches desired kernel sources, unless you're using a livecd-kernel in which case it does freaky stuff.
448
	def emerge_kernel_sources(self):
456
	def emerge_kernel_sources(self):
457
		self._logger.log("Starting emerge_kernel")
449
		
458
		
450
		kernel_pkg = self._install_profile.get_kernel_source_pkg()
459
		kernel_pkg = self._install_profile.get_kernel_source_pkg()
451
#		if kernel_pkg:
460
#		if kernel_pkg:
Lines 509-520 Link Here
509
			self._logger.log("Genkernel emerged.  Beginning kernel compile.")
518
			self._logger.log("Genkernel emerged.  Beginning kernel compile.")
510
			# Null the genkernel_options
519
			# Null the genkernel_options
511
			genkernel_options = ""
520
			genkernel_options = ""
512
	
521
513
			# If the uri for the kernel config is not null, then
514
			if kernel_config_uri != "":
515
				GLIUtility.get_uri(kernel_config_uri, self._chroot_dir + "/root/kernel_config")
516
				genkernel_options = genkernel_options + " --kernel-config=/root/kernel_config"
517
				
518
			# Decide whether to use bootsplash or not
522
			# Decide whether to use bootsplash or not
519
			if self._install_profile.get_kernel_bootsplash():
523
			if self._install_profile.get_kernel_bootsplash():
520
				genkernel_options = genkernel_options + " --bootsplash"
524
				genkernel_options = genkernel_options + " --bootsplash"
Lines 567-575 Link Here
567
			exitstatus = GLIUtility.spawn("rm "+self._chroot_dir+"/root/kernel_script")
571
			exitstatus = GLIUtility.spawn("rm "+self._chroot_dir+"/root/kernel_script")
568
			#it's not important if this fails.
572
			#it's not important if this fails.
569
			self._logger.log("Custom kernel complete")
573
			self._logger.log("Custom kernel complete")
570
			
574
575
576
	##
577
	# Installs the kernels as defined in the install profile.
578
	def install_kernel(self):
579
		self._logger.log("Checking for kernels to install.")
580
581
		# Get the kernels to install.
582
		kernels = self._install_profile.get_kernels()
583
584
		# Install each kernel.
585
		for kernel in kernels:
586
			if (kernel['type'] == 'precompiled'):
587
				self._install_kernel_precompiled(kernel['kernel']);
588
			elif (kernel['type'] == 'emerge'):
589
				self._install_kernel_emerge;
590
591
	##
592
	# Function to install a precompiled kernel.
593
	def _install_kernel_precompiled(self, kernel):
594
		self._logger.log("Installing precompiled kernel " + kernel)
595
		if (GLIUtility.spawn("emerge -K " + kernel, display_on_tty8=True, chroot=self._chroot_dir, logfile=self._compile_logfile, append_log=True)):
596
			raise GLIException("KernelInstallError", 'fatal', 'install_kernel', "Could not install precompiled kernel!")
597
		self._logger.log("Kernel install finished.")
598
571
	##
599
	##
572
	# Installs and sets up logging daemon on the new system.  adds to runlevel too.
600
	# Installs and sets up logging daemon on the new system. Adds to runlevel
601
	# too.
573
	def install_logging_daemon(self):
602
	def install_logging_daemon(self):
574
		
603
		
575
		# Get loggin daemon info
604
		# Get loggin daemon info
(-)GLIInstallProfile.py (-2 / +29 lines)
Lines 40-45 Link Here
40
		parser.addHandler('gli-profile/cron-daemon', self.set_cron_daemon_pkg)
40
		parser.addHandler('gli-profile/cron-daemon', self.set_cron_daemon_pkg)
41
		parser.addHandler('gli-profile/root-pass-hash', self.set_root_pass_hash)
41
		parser.addHandler('gli-profile/root-pass-hash', self.set_root_pass_hash)
42
		parser.addHandler('gli-profile/kernel-config', self.set_kernel_config_uri)
42
		parser.addHandler('gli-profile/kernel-config', self.set_kernel_config_uri)
43
		parser.addHandler('gli-profile/kernels/kernel', self.set_kernel)
43
		parser.addHandler('gli-profile/domainname', self.set_domainname)
44
		parser.addHandler('gli-profile/domainname', self.set_domainname)
44
		parser.addHandler('gli-profile/portage-snapshot', self.set_portage_tree_snapshot_uri)
45
		parser.addHandler('gli-profile/portage-snapshot', self.set_portage_tree_snapshot_uri)
45
		parser.addHandler('gli-profile/time-zone', self.set_time_zone)
46
		parser.addHandler('gli-profile/time-zone', self.set_time_zone)
Lines 74-79 Link Here
74
		self._boot_loader_pkg = ""
75
		self._boot_loader_pkg = ""
75
		self._kernel_modules = []
76
		self._kernel_modules = []
76
		self._kernel_config_uri = ""
77
		self._kernel_config_uri = ""
78
		self._kernels = []
77
		self._bootloader_kernel_args = ""
79
		self._bootloader_kernel_args = ""
78
		self._kernel_initrd = True
80
		self._kernel_initrd = True
79
		self._kernel_bootsplash = False
81
		self._kernel_bootsplash = False
Lines 254-259 Link Here
254
		self._kernel_config_uri = kernel_config_uri
256
		self._kernel_config_uri = kernel_config_uri
255
257
256
	##
258
	##
259
	# Returns the kernels that need to be installed and how.
260
	def get_kernels(self):
261
		"returns kernels"
262
		return self._kernels
263
264
	##
265
	# Brief description of function
266
	# @param xml_path Used internally by the XML parser. Should be None when calling directly
267
	# @param kernels Parameter description
268
	# @param xml_attr Parameter description
269
	def set_kernel(self, xml_path, kernel, attr=None):
270
		"""
271
		kernels is a hash containing all the kernels to be installed, the
272
		method to install them and where to fetch from if so required.
273
		"""
274
275
		kernel_type = str(attr.getValue('type'))
276
277
		# Check type
278
		if type(kernel) != str:
279
			raise GLIException("KernelError", 'fatal', 'set_kernel',  "Must be a string!")
280
281
		self._kernels.append({'type': kernel_type, 'kernel': kernel})
282
283
	##
257
	# Brief description of function
284
	# Brief description of function
258
	def get_bootloader_kernel_args(self):
285
	def get_bootloader_kernel_args(self):
259
		"returns kernel arguments"
286
		"returns kernel arguments"
Lines 1007-1014 Link Here
1007
		"""
1034
		"""
1008
		make_conf is a dictionary that will be set to _make_conf
1035
		make_conf is a dictionary that will be set to _make_conf
1009
1036
1010
		There is no checking that needs to be done, so please sure sure that the make_conf dictionary
1037
		There is no checking that needs to be done, so please sure sure that
1011
		that is passed in is valid.
1038
		the make_conf dictionary that is passed in is valid.
1012
		"""
1039
		"""
1013
1040
1014
		self._make_conf = make_conf
1041
		self._make_conf = make_conf
(-)GLIUtility.py (-2 / +3 lines)
Lines 441-447 Link Here
441
	tarball_filename = tarball_uri.split("/")[-1]
441
	tarball_filename = tarball_uri.split("/")[-1]
442
442
443
	# Get the tarball
443
	# Get the tarball
444
	get_uri(tarball_uri, temp_directory + "/" + tarball_filename)
444
	if (get_uri(tarball_uri, temp_directory + "/" + tarball_filename)) == 0:
445
		return False
445
446
446
	# Reset tar options
447
	# Reset tar options
447
	tar_options = "xv"
448
	tar_options = "xv"
Lines 462-468 Link Here
462
	exitstatus = spawn("tar -" + tar_options + " -f " + temp_directory + "/" + tarball_filename + " -C " + target_directory, display_on_tty8=True, logfile="/tmp/compile_output.log", append_log=True) # change this to the logfile variable
463
	exitstatus = spawn("tar -" + tar_options + " -f " + temp_directory + "/" + tarball_filename + " -C " + target_directory, display_on_tty8=True, logfile="/tmp/compile_output.log", append_log=True) # change this to the logfile variable
463
464
464
	if not exitsuccess(exitstatus):
465
	if not exitsuccess(exitstatus):
465
		raise GLIException("UnpackTarballError", 'fatal', 'fetch_and_unpack_tarball',"Could not unpack tarball!")
466
		raise GLIException("UnpackTarballError", 'fatal', 'fetch_and_unpack_tarball', "Could not unpack tarball!")
466
467
467
468
468
def generate_random_password():
469
def generate_random_password():
(-)tests/install.py (+2 lines)
Lines 21-26 Link Here
21
	print "\ttimezone               set timezone"
21
	print "\ttimezone               set timezone"
22
	print "\temerge_kernel          install the kernel sources"
22
	print "\temerge_kernel          install the kernel sources"
23
	print "\tbuild_kernel           build the kernel"
23
	print "\tbuild_kernel           build the kernel"
24
	print "\tinstall_kernel         install just the kernel"
24
	print "\tlogger                 install logger"
25
	print "\tlogger                 install logger"
25
	print "\tcrond                  install cron daemon"
26
	print "\tcrond                  install cron daemon"
26
	print "\tfstools                install filesystem tools"
27
	print "\tfstools                install filesystem tools"
Lines 68-73 Link Here
68
              'timezone': archtemplate.set_timezone,
69
              'timezone': archtemplate.set_timezone,
69
              'emerge_kernel': archtemplate.emerge_kernel_sources,
70
              'emerge_kernel': archtemplate.emerge_kernel_sources,
70
              'build_kernel': archtemplate.build_kernel,
71
              'build_kernel': archtemplate.build_kernel,
72
              'install_kernel': archtemplate.install_kernel,
71
              'logger': archtemplate.install_logging_daemon,
73
              'logger': archtemplate.install_logging_daemon,
72
              'crond': archtemplate.install_cron_daemon,
74
              'crond': archtemplate.install_cron_daemon,
73
              'fstools': archtemplate.install_filesystem_tools,
75
              'fstools': archtemplate.install_filesystem_tools,

Return to bug 89683