Create a marker to indicate that first boot has happened

This commit is contained in:
Simon Fels 2017-02-22 17:39:09 +01:00
commit fc7049b27b
3 changed files with 18 additions and 4 deletions

View file

@ -21,9 +21,17 @@
#include "anbox_rpc.pb.h"
#include "anbox_bridge.pb.h"
#include <fstream>
#include <sys/stat.h>
#define LOG_TAG "Anboxd"
#include <cutils/log.h>
namespace {
constexpr const char *first_boot_marker_path{"/data/.anbox_initialized"};
}
namespace anbox {
PlatformApiStub::PlatformApiStub(const std::shared_ptr<rpc::Channel> &rpc_channel) :
rpc_channel_(rpc_channel) {
@ -32,7 +40,13 @@ PlatformApiStub::PlatformApiStub(const std::shared_ptr<rpc::Channel> &rpc_channe
void PlatformApiStub::boot_finished() {
protobuf::bridge::EventSequence seq;
auto event = seq.mutable_boot_finished();
(void) event;
struct stat st;
if (stat(first_boot_marker_path, &st) != 0) {
event->set_first_boot_done(true);
std::ofstream marker(first_boot_marker_path);
}
rpc_channel_->send_event(seq);
}