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

Collapse All | Expand All

(-)modules/netboot2_target.py (-21 / +56 lines)
Lines 10-24 Link Here
10
class netboot2_target(generic_stage_target):
10
class netboot2_target(generic_stage_target):
11
	def __init__(self,spec,addlargs):
11
	def __init__(self,spec,addlargs):
12
		self.required_values=[
12
		self.required_values=[
13
			"boot/kernel",
13
			"boot/kernel"
14
			"netboot2/builddate",
15
			"netboot2/packages",			
16
			"netboot2/use"			
17
		]
14
		]
18
		self.valid_values=self.required_values[:]
15
		self.valid_values=self.required_values[:]
19
		self.valid_values.extend(self.required_values)
16
		self.valid_values.extend([
20
		self.valid_values.extend(["netboot2/extra_files"])
17
			"netboot2/packages",
21
			
18
			"netboot2/use",
19
			"netboot2/extra_files",
20
			"netboot2/overlay"
21
		])
22
22
		try:
23
		try:
23
			if addlargs.has_key("netboot2/packages"):
24
			if addlargs.has_key("netboot2/packages"):
24
				if type(addlargs["netboot2/packages"]) == types.StringType:
25
				if type(addlargs["netboot2/packages"]) == types.StringType:
Lines 31-51 Link Here
31
		except:
32
		except:
32
			raise CatalystError,"configuration error in netboot2/packages."
33
			raise CatalystError,"configuration error in netboot2/packages."
33
		
34
		
34
		
35
36
		generic_stage_target.__init__(self,spec,addlargs)
35
		generic_stage_target.__init__(self,spec,addlargs)
37
		self.set_build_kernel_vars()
36
		self.set_build_kernel_vars()
37
		self.settings["merge_path"]=normpath("/tmp/image/")
38
38
39
		# Merge packages into the buildroot, and pick out certain files to place in
40
		# /tmp/image
41
		self.settings["merge_path"]=normpath("/tmp/image")
42
43
	def set_dest_path(self):
44
		if self.settings.has_key("merge_path"):
45
			self.settings["destpath"]=normpath(self.settings["chroot_path"]+self.settings["merge_path"])
46
		else:
47
			self.settings["destpath"]=normpath(self.settings["chroot_path"])
48
49
	def set_target_path(self):
39
	def set_target_path(self):
50
		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\
40
		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\
51
			self.settings["target_subpath"]+"/")
41
			self.settings["target_subpath"]+"/")
Lines 99-104 Link Here
99
89
100
			touch(self.settings["autoresume_path"]+"copy_files_to_image")
90
			touch(self.settings["autoresume_path"]+"copy_files_to_image")
101
91
92
	def setup_overlay(self):	
93
		if self.settings.has_key("AUTORESUME") \
94
		and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
95
			print "Resume point detected, skipping setup_overlay operation..."
96
		else:
97
			if self.settings.has_key("netboot2/overlay"):
98
				for x in self.settings["netboot2/overlay"]: 
99
					if os.path.exists(x):
100
						cmd("rsync -a "+x+"/ "+\
101
							self.settings["chroot_path"], "netboot2/overlay: "+x+" copy failed.",env=self.env)
102
				touch(self.settings["autoresume_path"]+"setup_overlay")
102
103
103
	def move_kernels(self):
104
	def move_kernels(self):
104
		# we're done, move the kernels to builds/*
105
		# we're done, move the kernels to builds/*
Lines 112-124 Link Here
112
			self.unbind()
113
			self.unbind()
113
			raise CatalystError,"Failed to move kernel images!"
114
			raise CatalystError,"Failed to move kernel images!"
114
115
116
	def remove(self):
117
		if self.settings.has_key("AUTORESUME") \
118
			and os.path.exists(self.settings["autoresume_path"]+"remove"):
119
			print "Resume point detected, skipping remove operation..."
120
		else:
121
			if self.settings.has_key(self.settings["spec_prefix"]+"/rm"):
122
				for x in self.settings[self.settings["spec_prefix"]+"/rm"]:
123
					# we're going to shell out for all these cleaning operations,
124
					# so we get easy glob handling
125
					print "netboot2: removing " + x
126
					os.system("rm -rf " + self.settings["chroot_path"] + self.settings["merge_path"] + x)
115
127
128
	def empty(self):		
129
		if self.settings.has_key("AUTORESUME") \
130
			and os.path.exists(self.settings["autoresume_path"]+"empty"):
131
			print "Resume point detected, skipping empty operation..."
132
		else:
133
			if self.settings.has_key("netboot2/empty"):
134
				if type(self.settings["netboot2/empty"])==types.StringType:
135
					self.settings["netboot2/empty"]=self.settings["netboot2/empty"].split()
136
				for x in self.settings["netboot2/empty"]:
137
					myemp=self.settings["chroot_path"] + self.settings["merge_path"] + x
138
					if not os.path.isdir(myemp):
139
						print x,"not a directory or does not exist, skipping 'empty' operation."
140
						continue
141
					print "Emptying directory", x
142
					# stat the dir, delete the dir, recreate the dir and set
143
					# the proper perms and ownership
144
					mystat=os.stat(myemp)
145
					shutil.rmtree(myemp)
146
					os.makedirs(myemp,0755)
147
					os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
148
					os.chmod(myemp,mystat[ST_MODE])
149
		touch(self.settings["autoresume_path"]+"empty")
150
116
	def set_action_sequence(self):
151
	def set_action_sequence(self):
117
	    self.settings["action_sequence"]=["unpack","unpack_snapshot","config_profile_link",
152
	    self.settings["action_sequence"]=["unpack","unpack_snapshot","config_profile_link",
118
	    				"setup_confdir","bind","chroot_setup",\
153
	    				"setup_confdir","bind","chroot_setup",\
119
					"setup_environment","build_packages","root_overlay",\
154
					"setup_environment","build_packages","root_overlay",\
120
					"copy_files_to_image","build_kernel","move_kernels",\
155
					"copy_files_to_image","setup_overlay","build_kernel","move_kernels",\
121
					"unbind","clean","clear_autoresume"]
156
					"remove","empty","unbind","clean","clear_autoresume"]
122
157
123
def register(foo):
158
def register(foo):
124
	foo.update({"netboot2":netboot2_target})
159
	foo.update({"netboot2":netboot2_target})
(-)targets/netboot2/netboot2-copyfile.sh (-1 lines)
Lines 18-21 Link Here
18
		fi
18
		fi
19
	fi
19
	fi
20
done
20
done
21
echo ""
(-)targets/support/functions.sh (+5 lines)
Lines 124-129 Link Here
124
		then 
124
		then 
125
			mv ${1}/initramfs-* ${1}/${x}.igz
125
			mv ${1}/initramfs-* ${1}/${x}.igz
126
		fi
126
		fi
127
128
		if [ -e ${1}/System.map-* ];
129
		then
130
			mv ${1}/System.map-* ${1}/System.map-${x}
131
		fi
127
	done
132
	done
128
}
133
}
129
134
(-)targets/support/netboot2-final.sh (-1 / +5 lines)
Lines 14-19 Link Here
14
for x in ${clst_boot_kernel}; do
14
for x in ${clst_boot_kernel}; do
15
	mv ${clst_target_path}boot/${x} ${clst_target_path}kernels
15
	mv ${clst_target_path}boot/${x} ${clst_target_path}kernels
16
	mv ${clst_target_path}boot/${x}.igz ${clst_target_path}kernels/misc
16
	mv ${clst_target_path}boot/${x}.igz ${clst_target_path}kernels/misc
17
	mv ${clst_target_path}boot/System.map-${x} ${clst_target_path}kernels/misc
17
done
18
done
18
19
19
rmdir ${clst_target_path}boot
20
rmdir ${clst_target_path}boot
Lines 31-37 Link Here
31
		sleep 0
32
		sleep 0
32
		;;
33
		;;
33
	sparc*)
34
	sparc*)
34
		sleep 0
35
		for x in ${clst_boot_kernel}; do
36
			elftoaout ${clst_target_path}/kernels/${x} -o ${clst_target_path}${x}-a.out
37
			piggyback64 ${clst_target_path}/${x}-a.out ${clst_target_path}kernels/misc/System.map-${x} ${clst_target_path}kernels/misc/${x}.igz
38
		done
35
		;;
39
		;;
36
	ia64)
40
	ia64)
37
		sleep 0
41
		sleep 0
(-)targets/support/pre-kmerge.sh (-6 / +6 lines)
Lines 29-45 Link Here
29
29
30
		# Set the netboot builddate/hostname in linuxrc and copy to proper arch
30
		# Set the netboot builddate/hostname in linuxrc and copy to proper arch
31
		# directory in genkernel
31
		# directory in genkernel
32
		sed -e "s/@@MYDATE@@/${clst_netboot2_builddate}/g" \
32
		sed -e "s/@@MYDATE@@/$(date '+%Y%m%d')/g" \
33
		    -e "s/@@RELVER@@/${clst_version_stamp}/g" \
33
		    -e "s/@@RELVER@@/${clst_version_stamp}/g" \
34
			${clst_root_path}usr/share/genkernel/netboot/linuxrc.x \
34
			/usr/share/genkernel/netboot/linuxrc.x \
35
				> ${clst_root_path}usr/share/genkernel/${clst_hostarch}/linuxrc
35
			> /usr/share/genkernel/${clst_hostarch}/linuxrc
36
36
37
		echo ">>> Copying support files to ${clst_root_path} ..."
37
		echo ">>> Copying support files to ${clst_root_path} ..."
38
		cp -pPRf ${clst_root_path}usr/share/genkernel/netboot/misc/* \
38
		cp -pPRf /usr/share/genkernel/netboot/misc/* \
39
			${clst_merge_path}
39
			${clst_merge_path}
40
40
41
		echo ">>> Copying busybox config ..."
41
		echo ">>> Copying busybox config ..."
42
		cp -f ${clst_root_path}usr/share/genkernel/${clst_hostarch}/nb-busybox.cf \
42
		cp -f /usr/share/genkernel/${clst_hostarch}/nb-busybox.cf \
43
			${clst_root_path}usr/share/genkernel/${clst_hostarch}/busy-config
43
			/usr/share/genkernel/${clst_hostarch}/busy-config
44
	;;
44
	;;
45
esac
45
esac

Return to bug 173826