preinit-mounts: Add a proper init alternative

The obmc-ubi-fs feature enables a recipe 'preinit-mounts' that
installs a systemd-launcher script at /sbin/init.  This prevents
systemd from installing the /sbin/init alternative.
Add an init alternative to preinit-mounts and set it priority
higher than the one provided by systemd.

Tested: Built and verified Witherspoon image with QEMU
Change-Id: Iaddfcd4b59148d9c5d96b4634bf575ff8c2a05e0
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-phosphor/common/recipes-phosphor/preinit-mounts/preinit-mounts.bb b/meta-phosphor/common/recipes-phosphor/preinit-mounts/preinit-mounts.bb
index e3aaf54..282f863 100644
--- a/meta-phosphor/common/recipes-phosphor/preinit-mounts/preinit-mounts.bb
+++ b/meta-phosphor/common/recipes-phosphor/preinit-mounts/preinit-mounts.bb
@@ -1,10 +1,19 @@
 inherit obmc-phosphor-license
+inherit update-alternatives
 
 SRC_URI += "file://init"
 
-FILES_${PN} += "/sbin/init"
+FILES_${PN} += "${base_sbindir}/init"
 
 do_install() {
-	install -d ${D}/sbin
-	install -m 0755 ${WORKDIR}/init ${D}/sbin/init
+	install -d ${D}/${base_sbindir}
+	install -m 0755 ${WORKDIR}/init ${D}/${base_sbindir}/preinit-mounts
 }
+
+ALTERNATIVE_${PN} = "init"
+ALTERNATIVE_TARGET[init] = "${base_sbindir}/preinit-mounts"
+ALTERNATIVE_LINK_NAME[init] = "${base_sbindir}/init"
+
+# Use a number higher than the systemd init alternative so that
+# ours is enabled instead.
+ALTERNATIVE_PRIORITY[init] ?= "400"