View | Details | Raw Unified
Collapse All | Expand All

(-) modules/netboot2_target.py (-21 / +56 lines)
 Lines 10-24    Link Here 
class netboot2_target(generic_stage_target):
class netboot2_target(generic_stage_target):
	def __init__(self,spec,addlargs):
	def __init__(self,spec,addlargs):
		self.required_values=[
		self.required_values=[
			"boot/kernel",
			"boot/kernel"
			"netboot2/builddate",
			"netboot2/packages",			
			"netboot2/use"			
		]
		]
		self.valid_values=self.required_values[:]
		self.valid_values=self.required_values[:]
		self.valid_values.extend(self.required_values)
		self.valid_values.extend([
		self.valid_values.extend(["netboot2/extra_files"])
			"netboot2/packages",
			
			"netboot2/use",
			"netboot2/extra_files",
			"netboot2/overlay"
		])
		try:
		try:
			if addlargs.has_key("netboot2/packages"):
			if addlargs.has_key("netboot2/packages"):
				if type(addlargs["netboot2/packages"]) == types.StringType:
				if type(addlargs["netboot2/packages"]) == types.StringType:
 Lines 31-51    Link Here 
		except:
		except:
			raise CatalystError,"configuration error in netboot2/packages."
			raise CatalystError,"configuration error in netboot2/packages."
		
		
		
		generic_stage_target.__init__(self,spec,addlargs)
		generic_stage_target.__init__(self,spec,addlargs)
		self.set_build_kernel_vars()
		self.set_build_kernel_vars()
		self.settings["merge_path"]=normpath("/tmp/image/")
		# Merge packages into the buildroot, and pick out certain files to place in
		# /tmp/image
		self.settings["merge_path"]=normpath("/tmp/image")
	def set_dest_path(self):
		if self.settings.has_key("merge_path"):
			self.settings["destpath"]=normpath(self.settings["chroot_path"]+self.settings["merge_path"])
		else:
			self.settings["destpath"]=normpath(self.settings["chroot_path"])
	def set_target_path(self):
	def set_target_path(self):
		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\
		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\
			self.settings["target_subpath"]+"/")
			self.settings["target_subpath"]+"/")
 Lines 99-104    Link Here 
			touch(self.settings["autoresume_path"]+"copy_files_to_image")
			touch(self.settings["autoresume_path"]+"copy_files_to_image")
	def setup_overlay(self):	
		if self.settings.has_key("AUTORESUME") \
		and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
			print "Resume point detected, skipping setup_overlay operation..."
		else:
			if self.settings.has_key("netboot2/overlay"):
				for x in self.settings["netboot2/overlay"]: 
					if os.path.exists(x):
						cmd("rsync -a "+x+"/ "+\
							self.settings["chroot_path"], "netboot2/overlay: "+x+" copy failed.",env=self.env)
				touch(self.settings["autoresume_path"]+"setup_overlay")
	def move_kernels(self):
	def move_kernels(self):
		# we're done, move the kernels to builds/*
		# we're done, move the kernels to builds/*
 Lines 112-124    Link Here 
			self.unbind()
			self.unbind()
			raise CatalystError,"Failed to move kernel images!"
			raise CatalystError,"Failed to move kernel images!"
	def remove(self):
		if self.settings.has_key("AUTORESUME") \
			and os.path.exists(self.settings["autoresume_path"]+"remove"):
			print "Resume point detected, skipping remove operation..."
		else:
			if self.settings.has_key(self.settings["spec_prefix"]+"/rm"):
				for x in self.settings[self.settings["spec_prefix"]+"/rm"]:
					# we're going to shell out for all these cleaning operations,
					# so we get easy glob handling
					print "netboot2: removing " + x
					os.system("rm -rf " + self.settings["chroot_path"] + self.settings["merge_path"] + x)
	def empty(self):		
		if self.settings.has_key("AUTORESUME") \
			and os.path.exists(self.settings["autoresume_path"]+"empty"):
			print "Resume point detected, skipping empty operation..."
		else:
			if self.settings.has_key("netboot2/empty"):
				if type(self.settings["netboot2/empty"])==types.StringType:
					self.settings["netboot2/empty"]=self.settings["netboot2/empty"].split()
				for x in self.settings["netboot2/empty"]:
					myemp=self.settings["chroot_path"] + self.settings["merge_path"] + x
					if not os.path.isdir(myemp):
						print x,"not a directory or does not exist, skipping 'empty' operation."
						continue
					print "Emptying directory", x
					# stat the dir, delete the dir, recreate the dir and set
					# the proper perms and ownership
					mystat=os.stat(myemp)
					shutil.rmtree(myemp)
					os.makedirs(myemp,0755)
					os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
					os.chmod(myemp,mystat[ST_MODE])
		touch(self.settings["autoresume_path"]+"empty")
	def set_action_sequence(self):
	def set_action_sequence(self):
	    self.settings["action_sequence"]=["unpack","unpack_snapshot","config_profile_link",
	    self.settings["action_sequence"]=["unpack","unpack_snapshot","config_profile_link",
	    				"setup_confdir","bind","chroot_setup",\
	    				"setup_confdir","bind","chroot_setup",\
					"setup_environment","build_packages","root_overlay",\
					"setup_environment","build_packages","root_overlay",\
					"copy_files_to_image","build_kernel","move_kernels",\
					"copy_files_to_image","setup_overlay","build_kernel","move_kernels",\
					"unbind","clean","clear_autoresume"]
					"remove","empty","unbind","clean","clear_autoresume"]
def register(foo):
def register(foo):
	foo.update({"netboot2":netboot2_target})
	foo.update({"netboot2":netboot2_target})
(-) targets/netboot2/netboot2-copyfile.sh (-1 lines)
 Lines 18-21    Link Here 
		fi
		fi
	fi
	fi
done
done
echo ""
(-) targets/support/functions.sh (+5 lines)
 Lines 124-129    Link Here 
		then 
		then 
			mv ${1}/initramfs-* ${1}/${x}.igz
			mv ${1}/initramfs-* ${1}/${x}.igz
		fi
		fi
		if [ -e ${1}/System.map-* ];
		then
			mv ${1}/System.map-* ${1}/System.map-${x}
		fi
	done
	done
}
}
(-) targets/support/netboot2-final.sh (-1 / +5 lines)
 Lines 14-19    Link Here 
for x in ${clst_boot_kernel}; do
for x in ${clst_boot_kernel}; do
	mv ${clst_target_path}boot/${x} ${clst_target_path}kernels
	mv ${clst_target_path}boot/${x} ${clst_target_path}kernels
	mv ${clst_target_path}boot/${x}.igz ${clst_target_path}kernels/misc
	mv ${clst_target_path}boot/${x}.igz ${clst_target_path}kernels/misc
	mv ${clst_target_path}boot/System.map-${x} ${clst_target_path}kernels/misc
done
done
rmdir ${clst_target_path}boot
rmdir ${clst_target_path}boot
 Lines 31-37    Link Here 
		sleep 0
		sleep 0
		;;
		;;
	sparc*)
	sparc*)
		sleep 0
		for x in ${clst_boot_kernel}; do
			elftoaout ${clst_target_path}/kernels/${x} -o ${clst_target_path}${x}-a.out
			piggyback64 ${clst_target_path}/${x}-a.out ${clst_target_path}kernels/misc/System.map-${x} ${clst_target_path}kernels/misc/${x}.igz
		done
		;;
		;;
	ia64)
	ia64)
		sleep 0
		sleep 0
(-) targets/support/pre-kmerge.sh (-6 / +6 lines)
 Lines 29-45    Link Here 
		# Set the netboot builddate/hostname in linuxrc and copy to proper arch
		# Set the netboot builddate/hostname in linuxrc and copy to proper arch
		# directory in genkernel
		# directory in genkernel
		sed -e "s/@@MYDATE@@/${clst_netboot2_builddate}/g" \
		sed -e "s/@@MYDATE@@/$(date '+%Y%m%d')/g" \
		    -e "s/@@RELVER@@/${clst_version_stamp}/g" \
		    -e "s/@@RELVER@@/${clst_version_stamp}/g" \
			${clst_root_path}usr/share/genkernel/netboot/linuxrc.x \
			/usr/share/genkernel/netboot/linuxrc.x \
				> ${clst_root_path}usr/share/genkernel/${clst_hostarch}/linuxrc
			> /usr/share/genkernel/${clst_hostarch}/linuxrc
		echo ">>> Copying support files to ${clst_root_path} ..."
		echo ">>> Copying support files to ${clst_root_path} ..."
		cp -pPRf ${clst_root_path}usr/share/genkernel/netboot/misc/* \
		cp -pPRf /usr/share/genkernel/netboot/misc/* \
			${clst_merge_path}
			${clst_merge_path}
		echo ">>> Copying busybox config ..."
		echo ">>> Copying busybox config ..."
		cp -f ${clst_root_path}usr/share/genkernel/${clst_hostarch}/nb-busybox.cf \
		cp -f /usr/share/genkernel/${clst_hostarch}/nb-busybox.cf \
			${clst_root_path}usr/share/genkernel/${clst_hostarch}/busy-config
			/usr/share/genkernel/${clst_hostarch}/busy-config
	;;
	;;
esac
esac