OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POSTINSTALL_RUNNER_ACTION_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POSTINSTALL_RUNNER_ACTION_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_POSTINSTALL_RUNNER_ACTION_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_POSTINSTALL_RUNNER_ACTION_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "update_engine/action.h" | 9 #include "update_engine/action.h" |
| 10 #include "update_engine/install_plan.h" |
10 | 11 |
11 // The Postinstall Runner Action is responsible for running the postinstall | 12 // The Postinstall Runner Action is responsible for running the postinstall |
12 // script of a successfully downloaded update. | 13 // script of a successfully downloaded update. |
13 | 14 |
14 namespace chromeos_update_engine { | 15 namespace chromeos_update_engine { |
15 | 16 |
16 class PostinstallRunnerAction; | 17 class PostinstallRunnerAction; |
17 class NoneType; | 18 class NoneType; |
18 | 19 |
19 template<> | 20 template<> |
20 class ActionTraits<PostinstallRunnerAction> { | 21 class ActionTraits<PostinstallRunnerAction> { |
21 public: | 22 public: |
22 // Takes the device path as input | 23 // Takes the device path as input |
23 typedef std::string InputObjectType; | 24 typedef InstallPlan InputObjectType; |
24 // Passes the device path as output | 25 // Passes the device path as output |
25 typedef std::string OutputObjectType; | 26 typedef InstallPlan OutputObjectType; |
26 }; | 27 }; |
27 | 28 |
28 class PostinstallRunnerAction : public Action<PostinstallRunnerAction> { | 29 class PostinstallRunnerAction : public Action<PostinstallRunnerAction> { |
29 public: | 30 public: |
30 PostinstallRunnerAction() {} | 31 explicit PostinstallRunnerAction(bool precommit) : precommit_(precommit) {} |
31 typedef ActionTraits<PostinstallRunnerAction>::InputObjectType | 32 typedef ActionTraits<PostinstallRunnerAction>::InputObjectType |
32 InputObjectType; | 33 InputObjectType; |
33 typedef ActionTraits<PostinstallRunnerAction>::OutputObjectType | 34 typedef ActionTraits<PostinstallRunnerAction>::OutputObjectType |
34 OutputObjectType; | 35 OutputObjectType; |
35 void PerformAction(); | 36 void PerformAction(); |
36 | 37 |
37 // This is a synchronous action, and thus TerminateProcessing() should | 38 // This is a synchronous action, and thus TerminateProcessing() should |
38 // never be called | 39 // never be called |
39 void TerminateProcessing() { CHECK(false); } | 40 void TerminateProcessing() { CHECK(false); } |
40 | 41 |
41 // Debugging/logging | 42 // Debugging/logging |
42 static std::string StaticType() { return "PostinstallRunnerAction"; } | 43 static std::string StaticType() { return "PostinstallRunnerAction"; } |
43 std::string Type() const { return StaticType(); } | 44 std::string Type() const { return StaticType(); } |
44 | 45 |
45 private: | 46 private: |
| 47 // If true, this action runs before we've committed to the new update |
| 48 // (by marking it as bootable in the partition table). |
| 49 bool precommit_; |
| 50 |
46 DISALLOW_COPY_AND_ASSIGN(PostinstallRunnerAction); | 51 DISALLOW_COPY_AND_ASSIGN(PostinstallRunnerAction); |
47 }; | 52 }; |
48 | 53 |
49 } // namespace chromeos_update_engine | 54 } // namespace chromeos_update_engine |
50 | 55 |
51 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POSTINSTALL_RUNNER_ACTION_H__ | 56 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POSTINSTALL_RUNNER_ACTION_H__ |
OLD | NEW |