Example #1
0
	def installBootfiles(self, destination):
		import stat
		import stack

		print('Applying boot files')

		name = 'stack-images'
		RPM = self.findFile(name)
		if not RPM:
			raise ValueError, "could not find %s" % name

		self.applyRPM(RPM, destination)

		images = os.path.join(destination, 'opt', 'stack', 'images')
		isolinux = os.path.join(destination, 'isolinux')

		shutil.move(os.path.join(images, 'isolinux'), isolinux)

		#
		# vmlinuz and initrd.img
		#
		for file in os.listdir(images):
			if file.startswith('vmlinuz-'):
				shutil.move(os.path.join(images, file),
					os.path.join(isolinux, 'vmlinuz'))
			if file.startswith('initrd.img-'):
				shutil.move(os.path.join(images, file),
					os.path.join(isolinux, 'initrd.img'))

		if stack.release == '7.x':
			imagesdir = os.path.join(destination, 'images')
		else:
			imagesdir = os.path.join(self.palletdir, 'images')

		if not os.path.exists(imagesdir):
			os.makedirs(imagesdir)

		if stack.release == '7.x':
			#
			# upgrade.img
			#
			fileold = os.path.join(os.path.join(images,
				'upgrade.img'))
			filenew = os.path.join(imagesdir, 'upgrade.img')
			print('fileold %s' % fileold)
			print('filenew %s' % filenew)
			shutil.copy(fileold, filenew)
		else:
			#
			# install.img
			#
			fileold = os.path.join(os.path.join(images,
				'install.img'))
			filenew = os.path.join(imagesdir, 'install.img')
			os.rename(fileold, filenew)

		os.chmod(filenew, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)

		if stack.release == '7.x':
			#
			# updates.img
			#
			fileold = os.path.join(os.path.join(images,
				'updates.img'))
			filenew = os.path.join(imagesdir, 'updates.img')

			os.rename(fileold, filenew)
			os.chmod(filenew,
				stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)

			#
			# squashfs.img from LiveOS
			#
			f = self.findFile('squashfs.img')
			if not f:
				raise ValueError, \
					"could not find 'squashfs.img'"

			fileold = f.getFullName()
			print('fileold %s' % f.getFullName())

			livenewdir = os.path.join(destination, 'LiveOS')
			if not os.path.exists(livenewdir):
				os.makedirs(livenewdir)

			filenew = os.path.join(livenewdir, 'squashfs.img')

			print('fileold %s' % fileold)
			print('filenew %s' % filenew)
			shutil.copy(fileold, filenew)
			os.chmod(filenew,
				stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)

		#
		# put the 'barnacle' executable in the ISO
		#
		name = 'stack-barnacle'
		RPM = self.findFile(name)
		if RPM:
			self.applyRPM(RPM, destination)
			src = os.path.join(destination, 'opt', 'stack',
				'bin', 'frontend-install.py')
			dst = os.path.join(destination, 'frontend-install.py')
			os.rename(src, dst)

		#
		# clean up other image files from the stack-image RPM
		#
		shutil.rmtree(os.path.join(destination, 'opt'),
			ignore_errors = 1)
		shutil.rmtree(os.path.join(destination, 'var'),
			ignore_errors = 1)

		return
Example #2
0
	def installBootfiles(self, destination):
		import stat

		print 'Applying boot files'

		name = 'stack-images'
		RPM = self.getBestRPM(name)
		if not RPM:
			raise ValueError, "could not find %s" % name

		self.applyRPM(RPM, destination)

		images = os.path.join(destination, 'opt', 'stack', 'images')
		isolinux = os.path.join(destination, 'isolinux')

		shutil.move(os.path.join(images, 'isolinux'), isolinux)

		#
		# vmlinuz and initrd.img
		#
		for file in os.listdir(images):
			if file.startswith('vmlinuz-'):
				shutil.move(os.path.join(images, file),
					os.path.join(isolinux, 'vmlinuz'))
			if file.startswith('initrd.img-'):
				shutil.move(os.path.join(images, file),
					os.path.join(isolinux, 'initrd.img'))

		#
		# install.img
		#
		imagesdir = os.path.join(self.rolldir, 'images')
		if not os.path.exists(imagesdir):
			os.makedirs(imagesdir)

		install = os.path.join(os.path.join(images, 'install.img'))
		image = os.path.join(imagesdir, 'install.img')
		os.rename(install, image)
		os.chmod(image, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)

		#
		# put the 'barnacle' executable in the ISO
		#
		name = 'stack-barnacle'
		RPM = self.getBestRPM(name)
		if RPM:
			self.applyRPM(RPM, destination)
			src = os.path.join(destination, 'opt', 'stack',
				'bin', 'frontend-install.py')
			dst = os.path.join(destination, 'frontend-install.py')
			os.rename(src, dst)

		#
		# clean up other image files from the stack-image RPM
		#
		shutil.rmtree(os.path.join(destination, 'opt'),
			ignore_errors = 1)
		shutil.rmtree(os.path.join(destination, 'var'),
			ignore_errors = 1)

		return
Example #3
0
	def installBootfiles(self, destination):
		import stat
		import stack

		print('Applying boot files')

		name = 'stack-images'
		RPM = self.findFile(name)
		if not RPM:
			raise ValueError("could not find %s" % name)

		self.applyRPM(RPM, destination)

		images = os.path.join(destination, 'opt', 'stack', 'images')
		isolinux = os.path.join(destination, 'isolinux')

		shutil.move(os.path.join(images, 'isolinux'), isolinux)

		#
		# vmlinuz and initrd.img
		#
		for file in os.listdir(images):
			if file.startswith('vmlinuz-'):
				shutil.move(os.path.join(images, file),
					os.path.join(isolinux, 'vmlinuz'))
			if file.startswith('initrd.img-'):
				shutil.move(os.path.join(images, file),
					os.path.join(isolinux, 'initrd.img'))

		imagesdir = os.path.join(self.palletdir, 'images')

		if not os.path.exists(imagesdir):
			os.makedirs(imagesdir)

		if stack.release == 'redhat6':
			#
			# install.img
			#
			fileold = os.path.join(os.path.join(images,
				'install.img'))
			filenew = os.path.join(imagesdir, 'install.img')
			os.rename(fileold, filenew)
			os.chmod(filenew, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)

		if stack.release == 'redhat7':
			#
			# updates.img
			#
			fileold = os.path.join(os.path.join(images, 'updates.img'))
			filenew = os.path.join(imagesdir, 'updates.img')

			if not os.path.exists(fileold):
				raise ValueError("cound not find '%s'" % fileold)

			os.rename(fileold, filenew)
			os.chmod(filenew,
				stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)

			#
			# squashfs.img from LiveOS
			#
			f = self.findFile('squashfs.img')
			if not f:
				raise ValueError("could not find 'squashfs.img'")

			fileold = f.getFullName()
			print('fileold %s' % f.getFullName())

			livenewdir = os.path.join(self.palletdir, 'LiveOS')
			if not os.path.exists(livenewdir):
				os.makedirs(livenewdir)

			filenew = os.path.join(livenewdir, 'squashfs.img')

			print('fileold %s' % fileold)
			print('filenew %s' % filenew)
			shutil.copy(fileold, filenew)
			os.chmod(filenew,
				stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)

		#
		# clean up other image files from the stack-image RPM
		#
		shutil.rmtree(os.path.join(destination, 'opt'),
			ignore_errors=1)
		shutil.rmtree(os.path.join(destination, 'var'),
			ignore_errors=1)

		return
Example #4
0
	def installBootfiles(self, destination):
		import stat
		import stack

		print 'Applying boot files'

		name = 'stack-images'
		RPM = self.getBestRPM(name)
		if not RPM:
			raise ValueError, "could not find %s" % name

		self.applyRPM(RPM, destination)

		images = os.path.join(destination, 'opt', 'stack', 'images')
		isolinux = os.path.join(destination, 'isolinux')

		shutil.move(os.path.join(images, 'isolinux'), isolinux)

		#
		# vmlinuz and initrd.img
		#
		for file in os.listdir(images):
			if file.startswith('vmlinuz-'):
				shutil.move(os.path.join(images, file),
					os.path.join(isolinux, 'vmlinuz'))
			if file.startswith('initrd.img-'):
				shutil.move(os.path.join(images, file),
					os.path.join(isolinux, 'initrd.img'))

		if stack.release == '7.x':
			imagesdir = os.path.join(destination, 'images')
		else:
			imagesdir = os.path.join(self.rolldir, 'images')

		if not os.path.exists(imagesdir):
			os.makedirs(imagesdir)

		if stack.release == '7.x':
			#
			# upgrade.img
			#
			fileold = os.path.join(os.path.join(images,
				'upgrade.img'))
			filenew = os.path.join(imagesdir, 'upgrade.img')
		else:
			#
			# install.img
			#
			fileold = os.path.join(os.path.join(images,
				'install.img'))
			filenew = os.path.join(imagesdir, 'install.img')

		os.rename(fileold, filenew)
		os.chmod(filenew, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)

		if stack.release == '7.x':
			#
			# updates.img
			#
			fileold = os.path.join(os.path.join(images,
				'updates.img'))
			filenew = os.path.join(imagesdir, 'updates.img')

			os.rename(fileold, filenew)
			os.chmod(filenew,
				stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)

			#
			# squashfs.img from LiveOS
			#
			liveolddir = 'default/x86_64/LiveOS'
			livenewdir = os.path.join(destination, 'LiveOS')
			if not os.path.exists(livenewdir):
				os.makedirs(livenewdir)

			fileold = os.path.join(os.path.join(liveolddir,
				'squashfs.img'))
			filenew = os.path.join(livenewdir, 'squashfs.img')

			os.rename(fileold, filenew)
			os.chmod(filenew,
				stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)

		#
		# put the 'barnacle' executable in the ISO
		#
		name = 'stack-barnacle'
		RPM = self.getBestRPM(name)
		if RPM:
			self.applyRPM(RPM, destination)
			src = os.path.join(destination, 'opt', 'stack',
				'bin', 'frontend-install.py')
			dst = os.path.join(destination, 'frontend-install.py')
			os.rename(src, dst)

		#
		# clean up other image files from the stack-image RPM
		#
		shutil.rmtree(os.path.join(destination, 'opt'),
			ignore_errors = 1)
		shutil.rmtree(os.path.join(destination, 'var'),
			ignore_errors = 1)

		return