From 7e1b986a31f44fbd67c892d873c18b19f547bcad Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Thu, 19 Mar 2015 14:10:01 -0500 Subject: updater: only include tune2fs support when libtune2fs is available Change-Id: Iebf965bb7f5352115be4039aa6ca5be5a6a6d219 --- updater/Android.mk | 5 ++++- updater/install.c | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/updater/Android.mk b/updater/Android.mk index cc2206134..0045d6fa7 100644 --- a/updater/Android.mk +++ b/updater/Android.mk @@ -53,7 +53,10 @@ tune2fs_static_libraries := \ libext2_uuid_static \ libext2_e2p \ libext2fs -LOCAL_STATIC_LIBRARIES += libtune2fs $(tune2fs_static_libraries) +ifneq ($(wildcard external/e2fsprogs/misc/tune2fs.h),) + LOCAL_STATIC_LIBRARIES += libtune2fs $(tune2fs_static_libraries) + LOCAL_CFLAGS += -DHAVE_LIBTUNE2FS +endif LOCAL_C_INCLUDES += external/e2fsprogs/misc LOCAL_C_INCLUDES += $(LOCAL_PATH)/.. diff --git a/updater/install.c b/updater/install.c index 20ee431de..7a73f28b9 100644 --- a/updater/install.c +++ b/updater/install.c @@ -48,7 +48,9 @@ #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" @@ -1491,6 +1493,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, "%s() expects args, got %d", name, argc); } @@ -1519,6 +1522,9 @@ Value* Tune2FsFn(const char* name, State* state, int argc, Expr* argv[]) { return ErrorAbort(state, "%s() returned error code %d", name, result); } return StringValue(strdup("t")); +#else + return ErrorAbort(state, "%s() support not present, no libtune2fs", name); +#endif // HAVE_LIBTUNE2FS } void RegisterInstallFunctions() { -- cgit v1.2.3