Add install-completed.conf

Part of a three CLs change that moves install-completed.conf from platform/init
to platform/installer.
Also moves crx-import.conf into the init directory to group the init scripts.

BUG=chromium:353400
TEST=Build chromeos-init and chromeos-installer. install-completed and
crx-import are both owned by chromeos-installer.

CQ-DEPEND=Ie874f191fc2ececd244469e4e6423a0d1c64df71
CQ-DEPEND=I5fd371c2bd9a20cd95a79b02525f88c179a1efd0

Change-Id: I0db3c3a932e654c95d77bbd1822b4fd011c0879f
Reviewed-on: https://chromium-review.googlesource.com/190433
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
diff --git a/crx-import.conf b/init/crx-import.conf
similarity index 100%
rename from crx-import.conf
rename to init/crx-import.conf
diff --git a/init/install-completed.conf b/init/install-completed.conf
new file mode 100644
index 0000000..ed3ccdb
--- /dev/null
+++ b/init/install-completed.conf
@@ -0,0 +1,27 @@
+# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+description   "Chrome OS post-install cleanup"
+author        "chromium-os-dev@chromium.org"
+
+# This job handles any cleanup that might be needed on first boot after
+# a Chrome OS update has been installed.
+
+start on starting boot-services
+
+# This is a pre-start so that this task will run before the "start" stanza
+# of the "starting" task that triggered it.
+pre-start script
+  # Check if we need to run post install tasks. The tasks should be safe
+  # to be run more than once, as we'll rerun the tasks in case the device
+  # shuts down before completing the tasks, though it's unlikely to happen.
+  INSTALL_COMPLETED=/mnt/stateful_partition/.install_completed
+  if [ -f "${INSTALL_COMPLETED}" ]; then
+    # Remove XKB cache files, as the files may be incompatible after upgrade.
+    rm -f /var/lib/xkb/*.xkm
+
+    # This has to be done at the end of the block.
+    rm -f "${INSTALL_COMPLETED}"
+  fi
+end script