disk_layout_util: Create the partition_script in the image directory.

The partition layout is defined in a json file used during build. Most
of the information there is stored in the GPT, such as partition order,
size, names, etc. The filesystem format is not explicitly stored
anywhere, but the partition is formatted with that format initially. For
squashfs, we not only need to know the filesystem format, but also the
options used to create it in order to modify and re-create it.

This patch stores the partition_script.sh in the output image directory
(src/build/images/$BOARD/$BUILD_NUMBER/) so other scripts like
mount_gpt_image.sh can use it to mount and umount the created image.

TEST=./build_image leaves the partition script in the output directory.

Change-Id: If7529fb22126c61bacbfa45ed6a4ae684d0bddd8
Reviewed-on: https://chromium-review.googlesource.com/247333
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
diff --git a/build_library/disk_layout_util.sh b/build_library/disk_layout_util.sh
index 150097f..6a95f97 100644
--- a/build_library/disk_layout_util.sh
+++ b/build_library/disk_layout_util.sh
@@ -440,11 +440,10 @@
   local outdev="$1"
   local disk_layout="$2"
-  # Build the partition table. We create a temporary file for this here.
-  local partition_script_path="$(mktemp)"
+  # Build the partition table and partition script.
+  local partition_script_path="$(dirname "${outdev}")/partition_script.sh"
   write_partition_script "${disk_layout}" "${partition_script_path}"
   run_partition_script "${outdev}" "${partition_script_path}"
-  rm "${partition_script_path}"
   # Emit the gpt scripts so we can use them from here on out.
   emit_gpt_scripts "${outdev}" "$(dirname "${outdev}")"