Persistence the led group asserted value by default

Currently, only IBM's P10 machine will persist the Asserted attribute
value of ledGroup by default. But for other systems, most do not need
to perform persistence actions.

The intent behind this commit is to add a switch to control the
persistence function, and it is enabled by default in CI and disabled
by default in Yocto.

Tested: Regardless of whether `persistent-led-asserted` is enabled or
disabled, the ledmanager process works fine.

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I75b59a12dde417a9ccadaf25b2af07fc33186a01
diff --git a/manager/led-main.cpp b/manager/led-main.cpp
index 281cac9..df0f2bb 100644
--- a/manager/led-main.cpp
+++ b/manager/led-main.cpp
@@ -19,6 +19,7 @@
 
 #include <algorithm>
 #include <iostream>
+#include <memory>
 
 int main(int argc, char** argv)
 {
@@ -51,14 +52,18 @@
     /** @brief vector of led groups */
     std::vector<std::unique_ptr<phosphor::led::Group>> groups;
 
+    std::shared_ptr<phosphor::led::Serialize> serializePtr = nullptr;
+#ifdef PERSISTENT_LED_ASSERTED
     /** @brief store and re-store Group */
-    phosphor::led::Serialize serialize(SAVED_GROUPS_FILE);
+    serializePtr =
+        std::make_shared<phosphor::led::Serialize>(SAVED_GROUPS_FILE);
+#endif
 
 #ifdef USE_LAMP_TEST
     phosphor::led::LampTest lampTest(event, manager);
 
     groups.emplace_back(std::make_unique<phosphor::led::Group>(
-        bus, LAMP_TEST_OBJECT, manager, serialize,
+        bus, LAMP_TEST_OBJECT, manager, serializePtr,
         std::bind(std::mem_fn(&phosphor::led::LampTest::requestHandler),
                   &lampTest, std::placeholders::_1, std::placeholders::_2)));
 
@@ -71,9 +76,9 @@
 
     /** Now create so many dbus objects as there are groups */
     std::ranges::transform(systemLedMap, std::back_inserter(groups),
-                           [&bus, &manager, &serialize](auto& grp) {
+                           [&bus, &manager, serializePtr](auto& grp) {
         return std::make_unique<phosphor::led::Group>(bus, grp.first, manager,
-                                                      serialize);
+                                                      serializePtr);
     });
 
     // Attach the bus to sd_event to service user requests