manager: allow running at non-standard path
Add an optional argument to the daemon to allow the persistent
location to be a non-standard path. This enables running the
application as a normal user on a developer system rather than
requiring it to be installed in a full BMC image.
Tested:
Ran with `biosconfig-manager /tmp/bios-config-manager`:
```
$ busctl --user tree xyz.openbmc_project.BIOSConfigManager
└─ /xyz
└─ /xyz/openbmc_project
└─ /xyz/openbmc_project/bios_config
├─ /xyz/openbmc_project/bios_config/manager
└─ /xyz/openbmc_project/bios_config/password
```
Change-Id: I42f688e233060c43983d2690facbb1026e678c77
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/src/main.cpp b/src/main.cpp
index 8c2d78b..1e960ae 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -24,8 +24,17 @@
#include <sdbusplus/asio/connection.hpp>
#include <sdbusplus/asio/object_server.hpp>
-int main()
+PHOSPHOR_LOG2_USING;
+
+int main(int argc, char** argv)
{
+ std::string persistPath = BIOS_PERSIST_PATH;
+ if (argc >= 2)
+ {
+ persistPath = argv[1];
+ info("Using temporary path {PATH}", "PATH", persistPath);
+ }
+
boost::asio::io_service io;
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
@@ -39,7 +48,7 @@
* Object path : /xyz/openbmc_project/bios_config/manager
* Interface : xyz.openbmc_project.BIOSConfig.Manager
*/
- bios_config::Manager manager(objectServer, systemBus, BIOS_PERSIST_PATH);
+ bios_config::Manager manager(objectServer, systemBus, persistPath);
/**
* Password class is responsible for handling methods and signals under
@@ -48,7 +57,7 @@
* Object path : /xyz/openbmc_project/bios_config/password
* Interface : xyz.openbmc_project.BIOSConfig.Password
*/
- bios_config_pwd::Password password(objectServer, systemBus);
+ bios_config_pwd::Password password(objectServer, systemBus, persistPath);
io.run();
return 0;