meson: build: Install systemd unit files

Tested: Verified the expected systemd service files were installed
        with -Dhost-bios-upgrade=enabled and -Dbmc-layout=ubi

Change-Id: I1a46dc3916da208ded9c07af60d7e6856d1fa0ee
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/meson.build b/meson.build
index 0faf7d3..b678268 100644
--- a/meson.build
+++ b/meson.build
@@ -75,6 +75,21 @@
 
 ssl = dependency('openssl')
 
+systemd = dependency('systemd')
+systemd_system_unit_dir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
+
+unit_files = [
+    'obmc-flash-bmc-setenv@.service',
+    'reboot-guard-disable.service',
+    'reboot-guard-enable.service',
+    'force-reboot.service',
+    'usr-local.mount',
+    'xyz.openbmc_project.Software.BMC.Updater.service',
+    'xyz.openbmc_project.Software.Download.service',
+    'xyz.openbmc_project.Software.Sync.service',
+    'xyz.openbmc_project.Software.Version.service'
+]
+
 sdbuspp = find_program('sdbus++')
 subdir('xyz/openbmc_project/Software/Image')
 
@@ -94,6 +109,10 @@
     subdir('ubi')
 endif
 
+if get_option('host-bios-upgrade').enabled()
+    unit_files += 'obmc-flash-host-bios@.service'
+endif
+
 if get_option('sync-bmc-files').enabled()
     executable(
         'phosphor-sync-software-manager',
@@ -153,3 +172,13 @@
 install_data('software.conf',
     install_dir: '/usr/lib/tmpfiles.d/'
 )
+
+foreach u : unit_files
+    configure_file(
+        copy: true,
+        input: u,
+        install: true,
+        install_dir: systemd_system_unit_dir,
+        output: u,
+    )
+endforeach
diff --git a/ubi/meson.build b/ubi/meson.build
index 5045dee..f2caf78 100644
--- a/ubi/meson.build
+++ b/ubi/meson.build
@@ -2,3 +2,24 @@
     'flash.cpp',
     'item_updater_helper.cpp'
 )
+
+ubi_unit_files = [
+    'obmc-flash-bmc-cleanup.service',
+    'obmc-flash-bmc-mirroruboot.service',
+    'obmc-flash-bmc-ubiremount.service',
+    'obmc-flash-bmc-ubiro@.service',
+    'obmc-flash-bmc-ubiro-remove@.service',
+    'obmc-flash-bmc-ubirw.service',
+    'obmc-flash-bmc-ubirw-remove.service',
+    'obmc-flash-bmc-updateubootvars@.service'
+]
+
+foreach u : ubi_unit_files
+    configure_file(
+        copy: true,
+        input: u,
+        install: true,
+        install_dir: systemd_system_unit_dir,
+        output: u,
+    )
+endforeach