Use unsquashfs specified by caller if possible am: f68e825640

Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/2624712

Change-Id: I2bd88d90fa5f2326245f50aa0ce3ab1cbce7b308
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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) ||