meson: change install_dir to /usr/libexec/entity-manager
We notice a issue that if user accidentally execute fru-device and
terminate it after few second, the xyz.openbmc_project.FruDevice
busname will not exist on dbus, but the status of FruDevice.service is
still active running.
It because sdbusplus changes the behavior of request_name() and it
allows the busname can be replaced by new service. [1]
In order to avoid unexpected behavior by running service binary
accidentally, move the install_dir to /usr/libexec/entity-manager.
Tested result:
- EntityManager is still running normally after the change
```
root@bmc:~# systemctl status xyz.openbmc_project.EntityManager.service
● xyz.openbmc_project.EntityManager.service - Entity Manager
Loaded: loaded (/usr/lib/systemd/system/xyz.openbmc_project.EntityManager.service; enabled; preset: enabled)
Active: active (running) since Wed 2024-03-20 23:25:44 PDT; 27min ago
Process: 596 ExecStartPre=/bin/mkdir -p /var/configuration (code=exited, status=0/SUCCESS)
Process: 679 ExecStartPre=/bin/mkdir -p /tmp/overlays (code=exited, status=0/SUCCESS)
Main PID: 687 (entity-manager)
CPU: 7.203s
CGroup: /system.slice/xyz.openbmc_project.EntityManager.service
└─687 /usr/libexec/entity-manager/entity-manager
```
- FruDevice is still running normally after the change
```
root@bmc:~# systemctl status xyz.openbmc_project.FruDevice.service
● xyz.openbmc_project.FruDevice.service - Fru Device
Loaded: loaded (/usr/lib/systemd/system/xyz.openbmc_project.FruDevice.service; enabled; preset: enabled)
Active: active (running) since Wed 2024-03-20 23:25:40 PDT; 28min ago
Main PID: 598 (fru-device)
CPU: 729ms
CGroup: /system.slice/xyz.openbmc_project.FruDevice.service
└─598 /usr/libexec/entity-manager/fru-device
```
[1] https://github.com/openbmc/sdbusplus/commit/946c940434a7d5403f469ce2ab56f9136293ff38
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I01c1f0fe7a1bdbaf74ec4d080b62450f4a90a057
diff --git a/service_files/xyz.openbmc_project.EntityManager.service b/service_files/xyz.openbmc_project.EntityManager.service
index 99452e2..59dd2b0 100644
--- a/service_files/xyz.openbmc_project.EntityManager.service
+++ b/service_files/xyz.openbmc_project.EntityManager.service
@@ -4,7 +4,7 @@
[Service]
ExecStartPre=/bin/mkdir -p /var/configuration
ExecStartPre=/bin/mkdir -p /tmp/overlays
-ExecStart=/usr/bin/entity-manager
+ExecStart=/usr/libexec/entity-manager/entity-manager
Restart=always
Type=dbus
BusName=xyz.openbmc_project.EntityManager
diff --git a/service_files/xyz.openbmc_project.FruDevice.service b/service_files/xyz.openbmc_project.FruDevice.service
index 8f5c00f..bcbe165 100644
--- a/service_files/xyz.openbmc_project.FruDevice.service
+++ b/service_files/xyz.openbmc_project.FruDevice.service
@@ -3,7 +3,7 @@
After=dbus.service
[Service]
-ExecStart=/usr/bin/fru-device
+ExecStart=/usr/libexec/entity-manager/fru-device
Restart=always
RestartSec=5
Type=simple
diff --git a/src/meson.build b/src/meson.build
index a7205ac..248404c 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,5 +1,6 @@
cpp_args = boost_args + ['-DPACKAGE_DIR="' + packagedir + '/"']
cpp_args += ['-DSYSCONF_DIR="' + sysconfdir + '/"' ]
+installdir = join_paths(get_option('libexecdir'), 'entity-manager')
executable(
'entity-manager',
@@ -18,6 +19,7 @@
valijson,
],
install: true,
+ install_dir: installdir,
)
if get_option('fru-device')
@@ -42,5 +44,6 @@
valijson,
],
install: true,
+ install_dir: installdir,
)
endif