summaryrefslogtreecommitdiffstats
path: root/updater/install.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'updater/install.cpp')
-rw-r--r--updater/install.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/updater/install.cpp b/updater/install.cpp
index 74feb56be..1c7964053 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -56,8 +56,12 @@
#include "openssl/sha.h"
#include "ota_io.h"
#include "updater.h"
+#include "applypatch/applypatch.h"
+#include "flashutils/flashutils.h"
#include "install.h"
+#ifdef HAVE_LIBTUNE2FS
#include "tune2fs.h"
+#endif
#ifdef USE_EXT4
#include "make_ext4fs.h"
@@ -1478,6 +1482,7 @@ Value* RebootNowFn(const char* name, State* state, int argc, Expr* argv[]) {
memset(buffer, 0, sizeof(((struct bootloader_message*)0)->command));
FILE* f = fopen(filename, "r+b");
fseek(f, offsetof(struct bootloader_message, command), SEEK_SET);
+ fseek(f, BOOTLOADER_MESSAGE_OFFSET_IN_MISC, SEEK_CUR);
ota_fwrite(buffer, sizeof(((struct bootloader_message*)0)->command), 1, f);
fclose(f);
free(filename);
@@ -1520,6 +1525,7 @@ Value* SetStageFn(const char* name, State* state, int argc, Expr* argv[]) {
// package installation.
FILE* f = fopen(filename, "r+b");
fseek(f, offsetof(struct bootloader_message, stage), SEEK_SET);
+ fseek(f, BOOTLOADER_MESSAGE_OFFSET_IN_MISC, SEEK_CUR);
int to_write = strlen(stagestr)+1;
int max_size = sizeof(((struct bootloader_message*)0)->stage);
if (to_write > max_size) {
@@ -1546,6 +1552,7 @@ Value* GetStageFn(const char* name, State* state, int argc, Expr* argv[]) {
char buffer[sizeof(((struct bootloader_message*)0)->stage)];
FILE* f = fopen(filename, "rb");
fseek(f, offsetof(struct bootloader_message, stage), SEEK_SET);
+ fseek(f, BOOTLOADER_MESSAGE_OFFSET_IN_MISC, SEEK_CUR);
ota_fread(buffer, sizeof(buffer), 1, f);
fclose(f);
buffer[sizeof(buffer)-1] = '\0';
@@ -1585,6 +1592,7 @@ Value* EnableRebootFn(const char* name, State* state, int argc, Expr* argv[]) {
}
Value* Tune2FsFn(const char* name, State* state, int argc, Expr* argv[]) {
+#ifdef HAVE_LIBTUNE2FS
if (argc == 0) {
return ErrorAbort(state, kArgsParsingFailure, "%s() expects args, got %d", name, argc);
}
@@ -1613,6 +1621,9 @@ Value* Tune2FsFn(const char* name, State* state, int argc, Expr* argv[]) {
name, result);
}
return StringValue(strdup("t"));
+#else
+ return ErrorAbort(state, "%s() support not present, no libtune2fs", name);
+#endif // HAVE_LIBTUNE2FS
}
void RegisterInstallFunctions() {