Darin Petkov | 6d5dbf6 | 2010-11-08 16:09:55 -0800 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POSTINSTALL_RUNNER_ACTION_H__ |
| 6 | #define CHROMEOS_PLATFORM_UPDATE_ENGINE_POSTINSTALL_RUNNER_ACTION_H__ |
| 7 | |
| 8 | #include <string> |
Darin Petkov | 6f03a3b | 2010-11-10 14:27:14 -0800 | [diff] [blame] | 9 | |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 10 | #include "update_engine/action.h" |
Andrew de los Reyes | f971443 | 2010-05-04 10:21:23 -0700 | [diff] [blame] | 11 | #include "update_engine/install_plan.h" |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 12 | |
| 13 | // The Postinstall Runner Action is responsible for running the postinstall |
| 14 | // script of a successfully downloaded update. |
| 15 | |
| 16 | namespace chromeos_update_engine { |
| 17 | |
Chris Sosa | d317e40 | 2013-06-12 13:47:09 -0700 | [diff] [blame] | 18 | class PostinstallRunnerAction : public InstallPlanAction { |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 19 | public: |
Chris Sosa | d317e40 | 2013-06-12 13:47:09 -0700 | [diff] [blame] | 20 | PostinstallRunnerAction(): powerwash_marker_created_(false) {} |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 21 | |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 22 | void PerformAction(); |
| 23 | |
Darin Petkov | 6f03a3b | 2010-11-10 14:27:14 -0800 | [diff] [blame] | 24 | // Note that there's no support for terminating this action currently. |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 25 | void TerminateProcessing() { CHECK(false); } |
| 26 | |
| 27 | // Debugging/logging |
| 28 | static std::string StaticType() { return "PostinstallRunnerAction"; } |
| 29 | std::string Type() const { return StaticType(); } |
| 30 | |
| 31 | private: |
Darin Petkov | 6f03a3b | 2010-11-10 14:27:14 -0800 | [diff] [blame] | 32 | // Subprocess::Exec callback. |
| 33 | void CompletePostinstall(int return_code); |
| 34 | static void StaticCompletePostinstall(int return_code, |
| 35 | const std::string& output, |
| 36 | void* p); |
| 37 | |
Chris Sosa | d317e40 | 2013-06-12 13:47:09 -0700 | [diff] [blame] | 38 | InstallPlan install_plan_; |
Darin Petkov | 6f03a3b | 2010-11-10 14:27:14 -0800 | [diff] [blame] | 39 | std::string temp_rootfs_dir_; |
| 40 | |
Jay Srinivasan | 1c0fe79 | 2013-03-28 16:45:25 -0700 | [diff] [blame] | 41 | // True if Powerwash Marker was created before invoking post-install script. |
| 42 | // False otherwise. Used for cleaning up if post-install fails. |
| 43 | bool powerwash_marker_created_; |
| 44 | |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 45 | DISALLOW_COPY_AND_ASSIGN(PostinstallRunnerAction); |
| 46 | }; |
| 47 | |
| 48 | } // namespace chromeos_update_engine |
| 49 | |
| 50 | #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POSTINSTALL_RUNNER_ACTION_H__ |