Otapreopt: Add init script for A/B artifact move
Move the /data/ota -> /data/dalvik-cache move from the zygote into
a minimal shell script. Add an init rc file to execute the script
once /data is mounted. Add Makefile rules to pull these files in
with the rest of the A/B OTA dexopt components.
The move is motivated by the new naming scheme that includes the
slot name. Passing the slot name to the zygote would complicate
the process, while the value is immediately available in the script
through a simple getprop call.
Bug: 25612095
Bug: 28069686
Change-Id: I63e718d488662e1b1de2ce857629cb90aa4f611d
diff --git a/cmds/installd/Android.mk b/cmds/installd/Android.mk
index d35099a..86df596 100644
--- a/cmds/installd/Android.mk
+++ b/cmds/installd/Android.mk
@@ -96,6 +96,17 @@
LOCAL_CLANG := true
include $(BUILD_EXECUTABLE)
+# OTA slot script
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= otapreopt_slot
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := EXECUTABLES
+LOCAL_SRC_FILES := otapreopt_slot.sh
+LOCAL_INIT_RC := otapreopt.rc
+
+include $(BUILD_PREBUILT)
+
# OTA postinstall script
include $(CLEAR_VARS)
@@ -104,9 +115,9 @@
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_SRC_FILES := otapreopt_script.sh
-# Let this depend on otapreopt and the chroot tool, so we just have to mention one in a
-# configuration.
-LOCAL_REQUIRED_MODULES := otapreopt otapreopt_chroot
+# Let this depend on otapreopt, the chroot tool and the slot script, so we just have to mention one
+# in a configuration.
+LOCAL_REQUIRED_MODULES := otapreopt otapreopt_chroot otapreopt_slot
include $(BUILD_PREBUILT)