build: Rename .service files to service.in

Rename the .service files to .service.in to allow service files
to support config variable substitution. Ex, this line in .in:
  ExecStart=/usr/bin/obmc-flash-bmc ubiro @IMG_UPLOAD_DIR@
would become this in .service file:
  ExecStart=/usr/bin/obmc-flash-bmc ubiro "/tmp/images"

This allows the service files to use the user defined config
values instead of making assumptions that the default is used.

This commit only renames the service files. The subsequent
commit will make use of this feature.

In addition, the subdir meson.build files were deleted with
this commit. The reason is that the service files need to be
moved to the main meson.build to be able to read the conf file,
and without the service files, the subdir meson.build files are
just a couple lines long so there's not really a reason to have a
separate meson.build file.

Tested: Verified the service files were installed as before.

Change-Id: I29190d1f0664352fbee8a0ada9de959fd0269d6e
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/force-reboot.service b/force-reboot.service.in
similarity index 100%
rename from force-reboot.service
rename to force-reboot.service.in
diff --git a/meson.build b/meson.build
index 62b9aeb..f39520e 100644
--- a/meson.build
+++ b/meson.build
@@ -80,15 +80,15 @@
 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'
+    'obmc-flash-bmc-setenv@.service.in',
+    'reboot-guard-disable.service.in',
+    'reboot-guard-enable.service.in',
+    'force-reboot.service.in',
+    'usr-local.mount.in',
+    'xyz.openbmc_project.Software.BMC.Updater.service.in',
+    'xyz.openbmc_project.Software.Download.service.in',
+    'xyz.openbmc_project.Software.Sync.service.in',
+    'xyz.openbmc_project.Software.Version.service.in'
 ]
 
 sdbuspp = find_program('sdbus++')
@@ -104,15 +104,35 @@
 )
 
 if get_option('bmc-layout').contains('static')
-    subdir('static')
+    image_updater_sources += files(
+        'static/flash.cpp',
+        'static/item_updater_helper.cpp'
+    )
 elif get_option('bmc-layout').contains('ubi')
-    subdir('ubi')
+    image_updater_sources += files(
+        'ubi/flash.cpp',
+        'ubi/item_updater_helper.cpp'
+    )
+
+    unit_files += [
+        'ubi/obmc-flash-bmc-cleanup.service.in',
+        'ubi/obmc-flash-bmc-mirroruboot.service.in',
+        'ubi/obmc-flash-bmc-ubiremount.service.in',
+        'ubi/obmc-flash-bmc-ubiro@.service.in',
+        'ubi/obmc-flash-bmc-ubiro-remove@.service.in',
+        'ubi/obmc-flash-bmc-ubirw.service.in',
+        'ubi/obmc-flash-bmc-ubirw-remove.service.in',
+        'ubi/obmc-flash-bmc-updateubootvars@.service.in'
+    ]
 elif get_option('bmc-layout').contains('mmc')
-    subdir('mmc')
+    image_updater_sources += files(
+        'mmc/flash.cpp',
+        'mmc/item_updater_helper.cpp'
+    )
 endif
 
 if get_option('host-bios-upgrade').enabled()
-    unit_files += 'obmc-flash-host-bios@.service'
+    unit_files += 'obmc-flash-host-bios@.service.in'
 endif
 
 if get_option('sync-bmc-files').enabled()
@@ -177,11 +197,11 @@
 
 foreach u : unit_files
     configure_file(
-        copy: true,
         input: u,
+        output: '@BASENAME@',
+        configuration: conf,
         install: true,
         install_dir: systemd_system_unit_dir,
-        output: u,
     )
 endforeach
 
diff --git a/mmc/meson.build b/mmc/meson.build
deleted file mode 100644
index 5045dee..0000000
--- a/mmc/meson.build
+++ /dev/null
@@ -1,4 +0,0 @@
-image_updater_sources += files(
-    'flash.cpp',
-    'item_updater_helper.cpp'
-)
diff --git a/obmc-flash-bmc-setenv@.service b/obmc-flash-bmc-setenv@.service.in
similarity index 100%
rename from obmc-flash-bmc-setenv@.service
rename to obmc-flash-bmc-setenv@.service.in
diff --git a/obmc-flash-host-bios@.service b/obmc-flash-host-bios@.service.in
similarity index 100%
rename from obmc-flash-host-bios@.service
rename to obmc-flash-host-bios@.service.in
diff --git a/reboot-guard-disable.service b/reboot-guard-disable.service.in
similarity index 100%
rename from reboot-guard-disable.service
rename to reboot-guard-disable.service.in
diff --git a/reboot-guard-enable.service b/reboot-guard-enable.service.in
similarity index 100%
rename from reboot-guard-enable.service
rename to reboot-guard-enable.service.in
diff --git a/static/meson.build b/static/meson.build
deleted file mode 100644
index 5045dee..0000000
--- a/static/meson.build
+++ /dev/null
@@ -1,4 +0,0 @@
-image_updater_sources += files(
-    'flash.cpp',
-    'item_updater_helper.cpp'
-)
diff --git a/ubi/meson.build b/ubi/meson.build
deleted file mode 100644
index f2caf78..0000000
--- a/ubi/meson.build
+++ /dev/null
@@ -1,25 +0,0 @@
-image_updater_sources += files(
-    '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
diff --git a/ubi/obmc-flash-bmc-cleanup.service b/ubi/obmc-flash-bmc-cleanup.service.in
similarity index 100%
rename from ubi/obmc-flash-bmc-cleanup.service
rename to ubi/obmc-flash-bmc-cleanup.service.in
diff --git a/ubi/obmc-flash-bmc-mirroruboot.service b/ubi/obmc-flash-bmc-mirroruboot.service.in
similarity index 100%
rename from ubi/obmc-flash-bmc-mirroruboot.service
rename to ubi/obmc-flash-bmc-mirroruboot.service.in
diff --git a/ubi/obmc-flash-bmc-ubiremount.service b/ubi/obmc-flash-bmc-ubiremount.service.in
similarity index 100%
rename from ubi/obmc-flash-bmc-ubiremount.service
rename to ubi/obmc-flash-bmc-ubiremount.service.in
diff --git a/ubi/obmc-flash-bmc-ubiro-remove@.service b/ubi/obmc-flash-bmc-ubiro-remove@.service.in
similarity index 100%
rename from ubi/obmc-flash-bmc-ubiro-remove@.service
rename to ubi/obmc-flash-bmc-ubiro-remove@.service.in
diff --git a/ubi/obmc-flash-bmc-ubiro@.service b/ubi/obmc-flash-bmc-ubiro@.service.in
similarity index 100%
rename from ubi/obmc-flash-bmc-ubiro@.service
rename to ubi/obmc-flash-bmc-ubiro@.service.in
diff --git a/ubi/obmc-flash-bmc-ubirw-remove.service b/ubi/obmc-flash-bmc-ubirw-remove.service.in
similarity index 100%
rename from ubi/obmc-flash-bmc-ubirw-remove.service
rename to ubi/obmc-flash-bmc-ubirw-remove.service.in
diff --git a/ubi/obmc-flash-bmc-ubirw.service b/ubi/obmc-flash-bmc-ubirw.service.in
similarity index 100%
rename from ubi/obmc-flash-bmc-ubirw.service
rename to ubi/obmc-flash-bmc-ubirw.service.in
diff --git a/ubi/obmc-flash-bmc-updateubootvars@.service b/ubi/obmc-flash-bmc-updateubootvars@.service.in
similarity index 100%
rename from ubi/obmc-flash-bmc-updateubootvars@.service
rename to ubi/obmc-flash-bmc-updateubootvars@.service.in
diff --git a/usr-local.mount b/usr-local.mount.in
similarity index 100%
rename from usr-local.mount
rename to usr-local.mount.in
diff --git a/xyz.openbmc_project.Software.BMC.Updater.service b/xyz.openbmc_project.Software.BMC.Updater.service.in
similarity index 100%
rename from xyz.openbmc_project.Software.BMC.Updater.service
rename to xyz.openbmc_project.Software.BMC.Updater.service.in
diff --git a/xyz.openbmc_project.Software.Download.service b/xyz.openbmc_project.Software.Download.service.in
similarity index 100%
rename from xyz.openbmc_project.Software.Download.service
rename to xyz.openbmc_project.Software.Download.service.in
diff --git a/xyz.openbmc_project.Software.Sync.service b/xyz.openbmc_project.Software.Sync.service.in
similarity index 100%
rename from xyz.openbmc_project.Software.Sync.service
rename to xyz.openbmc_project.Software.Sync.service.in
diff --git a/xyz.openbmc_project.Software.Version.service b/xyz.openbmc_project.Software.Version.service.in
similarity index 100%
rename from xyz.openbmc_project.Software.Version.service
rename to xyz.openbmc_project.Software.Version.service.in