Mark the active slot from update_engine instead of /postinstall.
In Chrome OS, we were reliying on the /postinst script to generate the
verity hashes and mark the new kernel as bootable. This means that we
also need to run /postinst from the other (not verified) slot when
doing a user-initiated rollback. The update_engine already interacts
with the bootloader via the BootControlInterface to mark the other slot
as unbootable and check if there are other slots available for
rollback.
This patch moves the responsibility of marking the new slot as bootable
from the /postinst script to the update_engine, introducing a new
SetActiveBootSlot() method in the BootControlInterface. Chrome OS
builds will continue to mark the new slot as active from /postinstall
in order to be compatible with old builds, resulting in the new slot
marked as active twice during a successful normal update.
Bug: 23523562
Test: cros flash and image to the new daemon; rolled it back
Change-Id: I02502d7b8e85523a6eb9a7721053739e8381d266
diff --git a/postinstall_runner_action_unittest.cc b/postinstall_runner_action_unittest.cc
index fd03a8f..a44d8d3 100644
--- a/postinstall_runner_action_unittest.cc
+++ b/postinstall_runner_action_unittest.cc
@@ -34,6 +34,7 @@
#include <gtest/gtest.h>
#include "update_engine/constants.h"
+#include "update_engine/fake_system_state.h"
#include "update_engine/test_utils.h"
#include "update_engine/utils.h"
@@ -58,13 +59,14 @@
// powerwash_required.
void DoTest(bool do_losetup, int err_code, bool powerwash_required);
- private:
+ protected:
static const char* kImageMountPointTemplate;
base::MessageLoopForIO base_loop_;
chromeos::BaseMessageLoop loop_{&base_loop_};
chromeos::AsynchronousSignalHandler async_signal_handler_;
Subprocess subprocess_;
+ FakeSystemState fake_system_state_;
};
class PostinstActionProcessorDelegate : public ActionProcessorDelegate {
@@ -190,7 +192,8 @@
install_plan.download_url = "http://devserver:8080/update";
install_plan.powerwash_required = powerwash_required;
feeder_action.set_obj(install_plan);
- PostinstallRunnerAction runner_action(powerwash_marker_file.c_str());
+ PostinstallRunnerAction runner_action(&fake_system_state_,
+ powerwash_marker_file.c_str());
BondActions(&feeder_action, &runner_action);
ObjectCollectorAction<InstallPlan> collector_action;
BondActions(&runner_action, &collector_action);
@@ -246,7 +249,7 @@
// Death tests don't seem to be working on Hardy
TEST_F(PostinstallRunnerActionTest, DISABLED_RunAsRootDeathTest) {
ASSERT_EQ(0, getuid());
- PostinstallRunnerAction runner_action;
+ PostinstallRunnerAction runner_action(&fake_system_state_);
ASSERT_DEATH({ runner_action.TerminateProcessing(); },
"postinstall_runner_action.h:.*] Check failed");
}