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> |
| 9 | #include "update_engine/action.h" |
Andrew de los Reyes | f971443 | 2010-05-04 10:21:23 -0700 | [diff] [blame] | 10 | #include "update_engine/install_plan.h" |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 11 | |
| 12 | // The Postinstall Runner Action is responsible for running the postinstall |
| 13 | // script of a successfully downloaded update. |
| 14 | |
| 15 | namespace chromeos_update_engine { |
| 16 | |
| 17 | class PostinstallRunnerAction; |
| 18 | class NoneType; |
| 19 | |
| 20 | template<> |
| 21 | class ActionTraits<PostinstallRunnerAction> { |
| 22 | public: |
| 23 | // Takes the device path as input |
Andrew de los Reyes | f971443 | 2010-05-04 10:21:23 -0700 | [diff] [blame] | 24 | typedef InstallPlan InputObjectType; |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 25 | // Passes the device path as output |
Andrew de los Reyes | f971443 | 2010-05-04 10:21:23 -0700 | [diff] [blame] | 26 | typedef InstallPlan OutputObjectType; |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | class PostinstallRunnerAction : public Action<PostinstallRunnerAction> { |
| 30 | public: |
Darin Petkov | 6d5dbf6 | 2010-11-08 16:09:55 -0800 | [diff] [blame] | 31 | PostinstallRunnerAction() {} |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 32 | typedef ActionTraits<PostinstallRunnerAction>::InputObjectType |
| 33 | InputObjectType; |
| 34 | typedef ActionTraits<PostinstallRunnerAction>::OutputObjectType |
| 35 | OutputObjectType; |
| 36 | void PerformAction(); |
| 37 | |
| 38 | // This is a synchronous action, and thus TerminateProcessing() should |
| 39 | // never be called |
| 40 | void TerminateProcessing() { CHECK(false); } |
| 41 | |
| 42 | // Debugging/logging |
| 43 | static std::string StaticType() { return "PostinstallRunnerAction"; } |
| 44 | std::string Type() const { return StaticType(); } |
| 45 | |
| 46 | private: |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 47 | DISALLOW_COPY_AND_ASSIGN(PostinstallRunnerAction); |
| 48 | }; |
| 49 | |
| 50 | } // namespace chromeos_update_engine |
| 51 | |
| 52 | #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POSTINSTALL_RUNNER_ACTION_H__ |