From dab783680bfd8e060d9f67a54a0f71e237861dac Mon Sep 17 00:00:00 2001 From: Yunhee Seo Date: Fri, 16 May 2025 17:45:53 +0900 Subject: [PATCH] unified-system-plugin: Change to include files in storaged package by flag Instead of separating unified-system-plugin files into a package, files are included in the main package 'storaged' according to a flag named enable_unified_system_service. flag name is synced same as other services. If flag is 1 then: libunified-system-service-storaged.so is included Unnecessary files for unified-system-plugin(storaged executable, systemd service files) are excluded If flag is not 1 then: libunified-system-service-storaged.so is excluded storaged executable, systemd service files are included Change-Id: Ic69a1c39c2e2688d1ccd97c92589b1be1c1f1df8 Signed-off-by: Yunhee Seo --- CMakeLists.txt | 21 +++++++++++++-------- packaging/storaged.spec | 33 +++++++++++++-------------------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a306ef6..470231b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,28 +42,33 @@ FOREACH(flag ${${PROJECT_NAME}_pkgs_CFLAGS}) ENDFOREACH(flag) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Werror -rdynamic -Wno-deprecated-declarations") -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions -DUNIFIED_SYSTEM_SERVICE_ENABLED=${UNIFIED_SYSTEM_SERVICE_ON}") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions -DUNIFIED_SYSTEM_SERVICE_ENABLED=${ENABLE_UNIFIED_SYSTEM_SERVICE}") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -lrt -fPIE") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") # To apply Armoring(Full RELRO), which means GOT Table becomes read-only. SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro,-z,now") -ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${PROJECT_NAME}_pkgs_LDFLAGS} "-ldl" "-lm") -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) - +if(${ENABLE_UNIFIED_SYSTEM_SERVICE}) ADD_LIBRARY(${LIBRARY_NAME} SHARED ${SRCS}) TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${PROJECT_NAME}_pkgs_LDFLAGS} "-ldl" "-lm") INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION ${LIB_INSTALL_DIR}/system/plugin/ COMPONENT RuntimeLibraries) +else() +ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${PROJECT_NAME}_pkgs_LDFLAGS} "-ldl" "-lm") +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) +endif() -INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/org.tizen.system.storage.conf DESTINATION /etc/dbus-1/system.d) +if (${ENABLE_UNIFIED_SYSTEM_SERVICE}) INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/org.tizen.system.storage-unified-system-service.conf DESTINATION /etc/dbus-1/system.d) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/block.conf DESTINATION /etc/storaged) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/storage.conf DESTINATION /etc/storaged) +else() +INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/org.tizen.system.storage.conf DESTINATION /etc/dbus-1/system.d) INSTALL(FILES ${CMAKE_SOURCE_DIR}/systemd/org.tizen.system.storage.service DESTINATION /usr/share/dbus-1/system-services) INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/systemd/ DESTINATION lib/systemd/system FILES_MATCHING PATTERN "storaged.service") +endif() +INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/block.conf DESTINATION /etc/storaged) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/storage.conf DESTINATION /etc/storaged) IF(BLOCK_MODULE STREQUAL on) ADD_SUBDIRECTORY(src/block) diff --git a/packaging/storaged.spec b/packaging/storaged.spec index 417f471..a5a5914 100644 --- a/packaging/storaged.spec +++ b/packaging/storaged.spec @@ -1,7 +1,7 @@ #These options are DEACTIVATED by default. %bcond_with emulator %define extended_storage 0 -%define unified_system_service_on 0 +%define enable_unified_system_service 0 Name: storaged Summary: Storaged @@ -54,12 +54,6 @@ Requires: /usr/bin/newfs_msdos %description storage daemon. -%package unified-system-plugin -Summary: unified-system-service plugin -Requires: %{name} = %{version}-%{release} -%description unified-system-plugin -unified-system-service plugin - %package module_block Summary: block module plugin Requires: %{name} = %{version}-%{release} @@ -118,7 +112,7 @@ This package can be installed optional for auto dbus test. -DBLOCK_TMPFS=on \ -DSTORAGE_MODULE=on \ -DEXTENDED_STORAGE=%{extended_storage} \ - -DUNIFIED_SYSTEM_SERVICE_ON=%{unified_system_service_on} \ + -DENABLE_UNIFIED_SYSTEM_SERVICE=%{enable_unified_system_service} \ -DCRITICAL_LOG_MODULE=on \ #eol @@ -131,7 +125,9 @@ make %{?jobs:-j%jobs} rm -rf %{buildroot} %make_install +%if %{enable_unified_system_service} != 1 %install_service delayed.target.wants storaged.service +%endif %if "%{asan}" == "1" mkdir -p %{buildroot}%{_unitdir}/storaged.service.d @@ -141,35 +137,32 @@ install -m 644 systemd/storaged.asan.conf %{buildroot}%{_unitdir}/storaged.servi %find_lang extended-sd %post +%if %{enable_unified_system_service} +mv %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage-unified-system-service.conf \ + %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage.conf +%endif + systemctl daemon-reload if [ "$1" == "1" ]; then systemctl restart storaged.service fi -%post unified-system-plugin -mv %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage-unified-system-service.conf \ - %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage.conf - %postun systemctl daemon-reload %files %manifest %{name}.manifest %license LICENSE.Apache-2.0 +%if %{enable_unified_system_service} +%config %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage-unified-system-service.conf +%{_libdir}/system/plugin/libunified-system-service-storaged.so +%else %config %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage.conf %{_datadir}/dbus-1/system-services/org.tizen.system.storage.service %{_unitdir}/delayed.target.wants/storaged.service %{_unitdir}/storaged.service %{_bindir}/storaged -%if "%{asan}" == "1" -%{_unitdir}/storaged.service.d/storaged.asan.conf %endif - -%files unified-system-plugin -%manifest %{name}.manifest -%license LICENSE.Apache-2.0 -%config %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage-unified-system-service.conf -%{_libdir}/system/plugin/libunified-system-service-storaged.so %if "%{asan}" == "1" %{_unitdir}/storaged.service.d/storaged.asan.conf %endif -- 2.34.1