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 #include "update_engine/omaha_response_handler_action.h" | 5 #include "update_engine/omaha_response_handler_action.h" |
6 #include <string> | 6 #include <string> |
7 #include "update_engine/utils.h" | 7 #include "update_engine/utils.h" |
8 | 8 |
9 using std::string; | 9 using std::string; |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 utils::BootKernelDevice(install_plan_.install_path); | 36 utils::BootKernelDevice(install_plan_.install_path); |
37 | 37 |
38 install_plan_.is_full_update = !response.is_delta; | 38 install_plan_.is_full_update = !response.is_delta; |
39 | 39 |
40 TEST_AND_RETURN(HasOutputPipe()); | 40 TEST_AND_RETURN(HasOutputPipe()); |
41 if (HasOutputPipe()) | 41 if (HasOutputPipe()) |
42 SetOutputObject(install_plan_); | 42 SetOutputObject(install_plan_); |
43 LOG(INFO) << "Using this install plan:"; | 43 LOG(INFO) << "Using this install plan:"; |
44 install_plan_.Dump(); | 44 install_plan_.Dump(); |
45 | 45 |
46 completer.set_success(true); | 46 completer.set_code(kActionCodeSuccess); |
47 } | 47 } |
48 | 48 |
49 bool OmahaResponseHandlerAction::GetInstallDev(const std::string& boot_dev, | 49 bool OmahaResponseHandlerAction::GetInstallDev(const std::string& boot_dev, |
50 std::string* install_dev) { | 50 std::string* install_dev) { |
51 TEST_AND_RETURN_FALSE(utils::StringHasPrefix(boot_dev, "/dev/")); | 51 TEST_AND_RETURN_FALSE(utils::StringHasPrefix(boot_dev, "/dev/")); |
52 string ret(boot_dev); | 52 string ret(boot_dev); |
53 string::reverse_iterator it = ret.rbegin(); // last character in string | 53 string::reverse_iterator it = ret.rbegin(); // last character in string |
54 // Right now, we just switch '3' and '5' partition numbers. | 54 // Right now, we just switch '3' and '5' partition numbers. |
55 TEST_AND_RETURN_FALSE((*it == '3') || (*it == '5')); | 55 TEST_AND_RETURN_FALSE((*it == '3') || (*it == '5')); |
56 *it = (*it == '3') ? '5' : '3'; | 56 *it = (*it == '3') ? '5' : '3'; |
57 *install_dev = ret; | 57 *install_dev = ret; |
58 return true; | 58 return true; |
59 } | 59 } |
60 | 60 |
61 } // namespace chromeos_update_engine | 61 } // namespace chromeos_update_engine |
OLD | NEW |