| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #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 |
| 12 namespace chromeos_update_engine { | 12 namespace chromeos_update_engine { |
| 13 | 13 |
| 14 using std::string; | 14 using std::string; |
| 15 using std::vector; | 15 using std::vector; |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 const string kPostinstallScript("/postinst"); | 18 const string kPostinstallScript("/postinst"); |
| 19 } | 19 } |
| 20 | 20 |
| 21 void PostinstallRunnerAction::PerformAction() { | 21 void PostinstallRunnerAction::PerformAction() { |
| 22 CHECK(HasInputObject()); | 22 CHECK(HasInputObject()); |
| 23 const InstallPlan install_plan = GetInputObject(); | 23 const InstallPlan install_plan = GetInputObject(); |
| 24 const string install_device = install_plan.install_path; | 24 const string install_device = install_plan.install_path; |
| 25 ScopedActionCompleter completer(processor_, this); | 25 ScopedActionCompleter completer(processor_, this); |
| 26 | 26 |
| 27 // Make mountpoint | 27 // Make mountpoint |
| 28 string temp_dir; | 28 string temp_dir; |
| 29 TEST_AND_RETURN(utils::MakeTempDirectory("/tmp/au_postint_mount.XXXXXX", | 29 TEST_AND_RETURN(utils::MakeTempDirectory("/tmp/au_postint_mount.XXXXXX", |
| 30 &temp_dir)); | 30 &temp_dir)); |
| 31 ScopedDirRemover temp_dir_remover(temp_dir); | 31 ScopedDirRemover temp_dir_remover(temp_dir); |
| 32 | 32 |
| 33 { | 33 { |
| 34 // Scope for the mount | 34 // Scope for the mount |
| 35 unsigned long mountflags = MS_RDONLY; | 35 unsigned long mountflags = MS_RDONLY; |
| 36 | 36 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 64 bool success = (rc == 0); | 64 bool success = (rc == 0); |
| 65 if (!success) { | 65 if (!success) { |
| 66 LOG(ERROR) << "Postinst command failed with code: " << rc; | 66 LOG(ERROR) << "Postinst command failed with code: " << rc; |
| 67 return; | 67 return; |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 if (HasOutputPipe()) { | 71 if (HasOutputPipe()) { |
| 72 SetOutputObject(install_plan); | 72 SetOutputObject(install_plan); |
| 73 } | 73 } |
| 74 completer.set_success(true); | 74 completer.set_code(kActionCodeSuccess); |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace chromeos_update_engine | 77 } // namespace chromeos_update_engine |
| OLD | NEW |