Use unsquashfs specified by caller if possible

When map_file_generator is invoked by the build system, build system
will pass path to `unsquashfs` binary via environment variable
UNSQUASHFS. Prefer the build system specified binary over the one found
in $PATH .

Test: th
Bug: 286870582
Change-Id: I3c2176bdb69d69fd34d6caf4bf2eff4dda0d9de1
diff --git a/payload_generator/squashfs_filesystem.cc b/payload_generator/squashfs_filesystem.cc
index 22b431d..4129349 100644
--- a/payload_generator/squashfs_filesystem.cc
+++ b/payload_generator/squashfs_filesystem.cc
@@ -72,7 +72,11 @@
   ScopedTempFile map_file("squashfs_file_map.XXXXXX");
   // Run unsquashfs to get the system file map.
   // unsquashfs -m <map-file> <squashfs-file>
-  vector<string> cmd = {"unsquashfs", "-m", map_file.path(), sqfs_path};
+  const char* unsquashfs = getenv("UNSQUASHFS");
+  if (unsquashfs == nullptr || unsquashfs[0] == '\0') {
+    unsquashfs = "unsquashfs";
+  }
+  vector<string> cmd = {unsquashfs, "-m", map_file.path(), sqfs_path};
   string stdout_str, stderr_str;
   int exit_code;
   if (!Subprocess::SynchronousExec(cmd, &exit_code, &stdout_str, &stderr_str) ||