Log the file format of cros_install on postinstall action

This patch adds a new function to utils which determines the format
of a file based on magic constants on the header and returns a
human-readable description of it. This currently only supports ELF
files and is used to log the file format of the cros_install
binary on post-install.

BUG=chromium:356187
TEST=Unittests.

Change-Id: Ie6e91c3f5fa398c39894704db9071489560a8ff7
Reviewed-on: https://chromium-review.googlesource.com/191609
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
4 files changed
tree: 73f75c03ae5c589e8bfe2781c4e4faa8b4701113
  1. init/
  2. policy_manager/
  3. .gitignore
  4. 99-gpio-dutflag.rules
  5. action.h
  6. action_mock.h
  7. action_pipe.h
  8. action_pipe_unittest.cc
  9. action_processor.cc
  10. action_processor.h
  11. action_processor_mock.h
  12. action_processor_unittest.cc
  13. action_unittest.cc
  14. build
  15. bzip.cc
  16. bzip.h
  17. bzip_extent_writer.cc
  18. bzip_extent_writer.h
  19. bzip_extent_writer_unittest.cc
  20. certificate_checker.cc
  21. certificate_checker.h
  22. certificate_checker_mock.h
  23. certificate_checker_unittest.cc
  24. chrome_browser_proxy_resolver.cc
  25. chrome_browser_proxy_resolver.h
  26. chrome_browser_proxy_resolver_unittest.cc
  27. clock.cc
  28. clock.h
  29. clock_interface.h
  30. connection_manager.cc
  31. connection_manager.h
  32. connection_manager_unittest.cc
  33. constants.cc
  34. constants.h
  35. cycle_breaker.cc
  36. cycle_breaker.h
  37. cycle_breaker_unittest.cc
  38. dbus_constants.h
  39. dbus_service.cc
  40. dbus_service.h
  41. dbus_wrapper_interface.h
  42. delta_diff_generator.cc
  43. delta_diff_generator.h
  44. delta_diff_generator_unittest.cc
  45. delta_performer.cc
  46. delta_performer.h
  47. delta_performer_unittest.cc
  48. download_action.cc
  49. download_action.h
  50. download_action_unittest.cc
  51. error_code.h
  52. extent_mapper.cc
  53. extent_mapper.h
  54. extent_mapper_unittest.cc
  55. extent_ranges.cc
  56. extent_ranges.h
  57. extent_ranges_unittest.cc
  58. extent_writer.cc
  59. extent_writer.h
  60. extent_writer_unittest.cc
  61. fake_clock.h
  62. fake_hardware.h
  63. fake_p2p_manager.h
  64. fake_p2p_manager_configuration.h
  65. file_descriptor.cc
  66. file_descriptor.h
  67. file_writer.cc
  68. file_writer.h
  69. file_writer_mock.h
  70. file_writer_unittest.cc
  71. filesystem_copier_action.cc
  72. filesystem_copier_action.h
  73. filesystem_copier_action_unittest.cc
  74. filesystem_iterator.cc
  75. filesystem_iterator.h
  76. filesystem_iterator_unittest.cc
  77. full_update_generator.cc
  78. full_update_generator.h
  79. full_update_generator_unittest.cc
  80. gen_coverage_html
  81. generate_delta_main.cc
  82. gpio_handler.cc
  83. gpio_handler.h
  84. gpio_handler_unittest.cc
  85. gpio_handler_unittest.h
  86. gpio_mock_file_descriptor.cc
  87. gpio_mock_file_descriptor.h
  88. gpio_mock_udev_interface.cc
  89. gpio_mock_udev_interface.h
  90. graph_types.h
  91. graph_utils.cc
  92. graph_utils.h
  93. graph_utils_unittest.cc
  94. hardware.cc
  95. hardware.h
  96. hardware_interface.h
  97. http_common.cc
  98. http_common.h
  99. http_fetcher.cc
  100. http_fetcher.h
  101. http_fetcher_unittest.cc
  102. hwid_override.cc
  103. hwid_override.h
  104. hwid_override_unittest.cc
  105. inherit-review-settings-ok
  106. install_plan.cc
  107. install_plan.h
  108. libcurl_http_fetcher.cc
  109. libcurl_http_fetcher.h
  110. LICENSE
  111. local_coverage_rate
  112. main.cc
  113. metadata.cc
  114. metadata.h
  115. metadata_unittest.cc
  116. mock_connection_manager.h
  117. mock_dbus_wrapper.h
  118. mock_file_writer.h
  119. mock_gpio_handler.h
  120. mock_hardware.h
  121. mock_http_fetcher.cc
  122. mock_http_fetcher.h
  123. mock_p2p_manager.h
  124. mock_payload_state.h
  125. mock_system_state.cc
  126. mock_system_state.h
  127. multi_range_http_fetcher.cc
  128. multi_range_http_fetcher.h
  129. omaha_hash_calculator.cc
  130. omaha_hash_calculator.h
  131. omaha_hash_calculator_unittest.cc
  132. omaha_request_action.cc
  133. omaha_request_action.h
  134. omaha_request_action_unittest.cc
  135. omaha_request_params.cc
  136. omaha_request_params.h
  137. omaha_request_params_unittest.cc
  138. omaha_response.h
  139. omaha_response_handler_action.cc
  140. omaha_response_handler_action.h
  141. omaha_response_handler_action_unittest.cc
  142. p2p_manager.cc
  143. p2p_manager.h
  144. p2p_manager_unittest.cc
  145. payload_signer.cc
  146. payload_signer.h
  147. payload_signer_unittest.cc
  148. payload_state.cc
  149. payload_state.h
  150. payload_state_interface.h
  151. payload_state_unittest.cc
  152. postinstall_runner_action.cc
  153. postinstall_runner_action.h
  154. postinstall_runner_action_unittest.cc
  155. prefs.cc
  156. prefs.h
  157. prefs_interface.h
  158. prefs_mock.h
  159. prefs_unittest.cc
  160. proxy_resolver.cc
  161. proxy_resolver.h
  162. real_dbus_wrapper.h
  163. real_system_state.cc
  164. real_system_state.h
  165. run_unittests
  166. sample_omaha_v3_response.xml
  167. SConstruct
  168. setup_dev_packages
  169. simple_key_value_store.cc
  170. simple_key_value_store.h
  171. simple_key_value_store_unittest.cc
  172. subprocess.cc
  173. subprocess.h
  174. subprocess_unittest.cc
  175. system_state.h
  176. tarjan.cc
  177. tarjan.h
  178. tarjan_unittest.cc
  179. terminator.cc
  180. terminator.h
  181. terminator_unittest.cc
  182. test_http_server.cc
  183. test_utils.cc
  184. test_utils.h
  185. testrunner.cc
  186. topological_sort.cc
  187. topological_sort.h
  188. topological_sort_unittest.cc
  189. udev_interface.h
  190. unittest_key.pem
  191. unittest_key2.pem
  192. update_attempter.cc
  193. update_attempter.h
  194. update_attempter_mock.h
  195. update_attempter_unittest.cc
  196. update_check_scheduler.cc
  197. update_check_scheduler.h
  198. update_check_scheduler_unittest.cc
  199. update_engine.xml
  200. update_engine_client.cc
  201. update_metadata.proto
  202. UpdateEngine.conf
  203. utils.cc
  204. utils.h
  205. utils_unittest.cc
  206. WATCHLISTS
  207. zip_unittest.cc