Make installing kernels work properly

Signed-off-by: Martin J. Bligh <mbligh@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@270 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/bin/autotest_utils.py b/bin/autotest_utils.py
index 407d16e..9f9fcd4 100755
--- a/bin/autotest_utils.py
+++ b/bin/autotest_utils.py
@@ -144,6 +144,11 @@
 	return shutil.copyfile(src, dest)
 
 
+def force_link(src, dest):
+	"""Link src to dest, overwriting it if it exists"""
+	return system("ln -sf %s %s" % (src, dest))
+
+
 def file_contains_pattern(file, pattern):
 	"""Return true if file contains the specified egrep pattern"""
 	if not os.path.isfile(file):
@@ -240,6 +245,14 @@
 		return arch
 
 
+def get_file_arch(filename):
+	# -L means follow symlinks
+	file_data = system_output('file -L ' + filename)
+	if file_data.count('80386'):
+		return 'i386'
+	return None
+
+
 def kernelexpand(kernel):
 	# if not (kernel.startswith('http://') or kernel.startswith('ftp://') or os.path.isfile(kernel)):
 	if kernel.find('/') < 0:     # contains no path.