archive_hwqual: Allow custom private key

Test images now may have ssh keys generated at build time. The assumption that
every test image shares the same key, 'testing_rsa' is no longer sound.

BUG=None
TEST=Trybot for rambi-a-release-group
CQ-DEPEND=CL:297023

Change-Id: Id1292173540cc34f59baa7118422d254152519bb
Reviewed-on: https://chromium-review.googlesource.com/297024
Commit-Ready: Daniel Wang <wonderfly@google.com>
Tested-by: Daniel Wang <wonderfly@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
diff --git a/archive_hwqual b/archive_hwqual
index bdd9b18..d26b276 100755
--- a/archive_hwqual
+++ b/archive_hwqual
@@ -9,12 +9,16 @@
 SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
 . "${SCRIPT_ROOT}/common.sh" || exit 1
 
+DEFAULT_PRIVATE_KEY="${SCRIPTS_DIR}/mod_for_test_scripts/ssh_keys/testing_rsa"
+
 # Flags
 DEFINE_string from "" "Directory with autotest tarball"
 DEFINE_string to "" "Directory to receive packaged hwqual"
 DEFINE_string output_tag "chromeos-hwqual" "Name used in tar"
 DEFINE_string image_dir "" "Directory containing test image."
 DEFINE_string image "${CHROMEOS_TEST_IMAGE_NAME}" "Name of image file to use."
+DEFINE_string ssh_private_key "${DEFAULT_PRIVATE_KEY}" \
+  "Path to the private ssh key to use for testing"
 
 TMP=$(mktemp -d "/tmp/image.XXXX")
 
@@ -77,8 +81,8 @@
     tarball
   ln -s autotest/client/site_tests/suite_HWQual/manual \
     "tarball/${FLAGS_output_tag}"
-  cp "${script_dir}/mod_for_test_scripts/ssh_keys/testing_rsa" \
-    "tarball/${FLAGS_output_tag}"
+  cp $(readlink -f "${FLAGS_ssh_private_key}") \
+    "tarball/${FLAGS_output_tag}/testing_rsa"
   chmod 0400 "tarball/${FLAGS_output_tag}/testing_rsa"
   mv autotest "tarball/${FLAGS_output_tag}"
   # Copy call_autoserv.py to tarball.