OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 #include "update_engine/postinstall_runner_action.h" | 5 #include "update_engine/postinstall_runner_action.h" |
6 #include <sys/mount.h> | 6 #include <sys/mount.h> |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <vector> | 8 #include <vector> |
9 #include "update_engine/subprocess.h" | 9 #include "update_engine/subprocess.h" |
10 #include "update_engine/utils.h" | 10 #include "update_engine/utils.h" |
11 | 11 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 LOG(ERROR) << "Unable to mount destination device " << install_device | 51 LOG(ERROR) << "Unable to mount destination device " << install_device |
52 << " onto " << temp_dir; | 52 << " onto " << temp_dir; |
53 return; | 53 return; |
54 } | 54 } |
55 ScopedFilesystemUnmounter unmounter(temp_dir); | 55 ScopedFilesystemUnmounter unmounter(temp_dir); |
56 | 56 |
57 // run postinstall script | 57 // run postinstall script |
58 vector<string> command; | 58 vector<string> command; |
59 command.push_back(temp_dir + kPostinstallScript); | 59 command.push_back(temp_dir + kPostinstallScript); |
60 command.push_back(install_device); | 60 command.push_back(install_device); |
61 command.push_back(precommit_ ? "" : "--postcommit"); | |
62 rc = 0; | 61 rc = 0; |
63 TEST_AND_RETURN(Subprocess::SynchronousExec(command, &rc)); | 62 TEST_AND_RETURN(Subprocess::SynchronousExec(command, &rc)); |
64 bool success = (rc == 0); | 63 bool success = (rc == 0); |
65 if (!success) { | 64 if (!success) { |
66 LOG(ERROR) << "Postinst command failed with code: " << rc; | 65 LOG(ERROR) << "Postinst command failed with code: " << rc; |
67 return; | 66 return; |
68 } | 67 } |
69 } | 68 } |
70 | 69 |
71 if (HasOutputPipe()) { | 70 if (HasOutputPipe()) { |
72 SetOutputObject(install_plan); | 71 SetOutputObject(install_plan); |
73 } | 72 } |
74 completer.set_code(kActionCodeSuccess); | 73 completer.set_code(kActionCodeSuccess); |
75 } | 74 } |
76 | 75 |
77 } // namespace chromeos_update_engine | 76 } // namespace chromeos_update_engine |
OLD | NEW |