Make BiosConfig run as one service.
As of now BiosConfig runs in two service as seen below.
1) xyz.openbmc_project.biosconfig_manager.service
busctl tree xyz.openbmc_project.BIOSConfigManager
`-/xyz
`-/xyz/openbmc_project
`-/xyz/openbmc_project/bios_config
`-/xyz/openbmc_project/bios_config/manager
2) xyz.openbmc_project.biosconfig_password.service
busctl tree xyz.openbmc_project.BIOSConfigPassword
`-/xyz
`-/xyz/openbmc_project
`-/xyz/openbmc_project/bios_config
`-/xyz/openbmc_project/bios_config/password
The code changes are to move functionalities of
xyz.openbmc_project.biosconfig_password.service to
xyz.openbmc_project.biosconfig_manager.service as
shown below
busctl 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
Tested:
Made sure BiosConfig functionality is not affected.
Note that calls from bmcweb will now require to use
service as xyz.openbmc_project.biosconfig_manager.service
Change-Id: I8adeb57ed3758041b2b9b0d1ddc714e418c4484e
Signed-off-by: Arun Lal K M <arun.lal@intel.com>
diff --git a/include/password.hpp b/include/password.hpp
index 154de4a..d79616b 100644
--- a/include/password.hpp
+++ b/include/password.hpp
@@ -30,8 +30,6 @@
namespace bios_config_pwd
{
-
-static constexpr auto servicePwd = "xyz.openbmc_project.BIOSConfigPassword";
static constexpr auto objectPathPwd =
"/xyz/openbmc_project/bios_config/password";
constexpr auto biosPasswordFile = "passwordData";
diff --git a/meson.build b/meson.build
index 9f9c057..87b2ec3 100755
--- a/meson.build
+++ b/meson.build
@@ -37,24 +37,20 @@
dependency('openssl'),
]
-executable('biosconfig-manager',
- 'src/manager.cpp',
- 'src/manager_serialize.cpp',
- implicit_include_directories: true,
- include_directories: ['include'],
- dependencies: deps,
- cpp_args : boost_args,
- install: true,
- install_dir: get_option('bindir'))
+src_files = ['src/main.cpp',
+ 'src/manager.cpp',
+ 'src/manager_serialize.cpp',
+ 'src/password.cpp'
+]
-executable('biosconfig-password',
- 'src/password.cpp',
- implicit_include_directories: true,
- include_directories: ['include'],
- dependencies: deps,
- cpp_args : boost_args,
- install: true,
- install_dir: get_option('bindir'))
+executable('biosconfig-manager',
+ src_files,
+ implicit_include_directories: true,
+ include_directories: ['include'],
+ dependencies: deps,
+ cpp_args : boost_args,
+ install: true,
+ install_dir: get_option('bindir'))
systemd = dependency('systemd')
systemd_system_unit_dir = systemd.get_variable(
@@ -68,11 +64,3 @@
install_dir: systemd_system_unit_dir,
output: 'xyz.openbmc_project.biosconfig_manager.service'
)
-
-configure_file(
- copy: true,
- input: 'service_files/xyz.openbmc_project.biosconfig_password.service',
- install: true,
- install_dir: systemd_system_unit_dir,
- output: 'xyz.openbmc_project.biosconfig_password.service'
-)
\ No newline at end of file
diff --git a/service_files/xyz.openbmc_project.biosconfig_password.service b/service_files/xyz.openbmc_project.biosconfig_password.service
deleted file mode 100644
index 8b4ef9d..0000000
--- a/service_files/xyz.openbmc_project.biosconfig_password.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description= BIOS Config Password - For Remote BIOS configuration update
-
-[Service]
-Restart=always
-ExecStart=/usr/bin/biosconfig-password
-SyslogIdentifier=biosconfig-password
-Type=dbus
-BusName=xyz.openbmc_project.BIOSConfigPassword
-
-[Install]
-WantedBy=multi-user.target
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..b0c8d84
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,54 @@
+/*
+// Copyright (c) 2020 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+*/
+
+#include "manager.hpp"
+#include "password.hpp"
+
+#include <boost/asio.hpp>
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/lg2.hpp>
+#include <sdbusplus/asio/connection.hpp>
+#include <sdbusplus/asio/object_server.hpp>
+
+int main()
+{
+ boost::asio::io_service io;
+ auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
+
+ systemBus->request_name(bios_config::service);
+ sdbusplus::asio::object_server objectServer(systemBus);
+
+ /**
+ * Manager class is responsible handling methods and signals under
+ * the following object path and interface.
+ *
+ * Object path : /xyz/openbmc_project/bios_config/manager
+ * Interface : xyz.openbmc_project.BIOSConfig.Manager
+ */
+ bios_config::Manager manager(objectServer, systemBus);
+
+ /**
+ * Password class is responsible handling methods and signals under
+ * the following object path and interface.
+ *
+ * Object path : /xyz/openbmc_project/bios_config/password
+ * Interface : xyz.openbmc_project.BIOSConfig.Password
+ */
+ bios_config_pwd::Password password(objectServer, systemBus);
+
+ io.run();
+ return 0;
+}
diff --git a/src/manager.cpp b/src/manager.cpp
index c2ea188..fa619a8 100644
--- a/src/manager.cpp
+++ b/src/manager.cpp
@@ -323,16 +323,3 @@
}
} // namespace bios_config
-
-int main()
-{
- boost::asio::io_service io;
- auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
-
- systemBus->request_name(bios_config::service);
- sdbusplus::asio::object_server objectServer(systemBus);
- bios_config::Manager manager(objectServer, systemBus);
-
- io.run();
- return 0;
-}
diff --git a/src/password.cpp b/src/password.cpp
index f3cb321..d13ed93 100644
--- a/src/password.cpp
+++ b/src/password.cpp
@@ -238,16 +238,3 @@
}
} // namespace bios_config_pwd
-
-int main()
-{
- boost::asio::io_service io;
- auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
-
- systemBus->request_name(bios_config_pwd::servicePwd);
- sdbusplus::asio::object_server objectServer(systemBus);
- bios_config_pwd::Password password(objectServer, systemBus);
-
- io.run();
- return 0;
-}