ENABLE_TESTING()
ADD_SUBDIRECTORY(tests)
ENDIF(DEFINED RD_TESTS_PATH)
+
+ADD_SUBDIRECTORY(isu)
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(ISU C)
+
+IF("${ISU_ARCH_BIT}" STREQUAL "32")
+ OPTION(USE_32BIT "Use 32bit architecture" ON)
+ELSEIF("${ISU_ARCH_BIT}" STREQUAL "64")
+ OPTION(USE_64BIT "Use 64bit architecture" ON)
+ENDIF()
+
+INSTALL(FILES isu.cfg DESTINATION /etc/isu/resourced/ PERMISSIONS OWNER_WRITE OWNER_READ)
+INSTALL(FILES resourced.service DESTINATION /etc/isu/resourced/system-services/ PERMISSIONS OWNER_WRITE OWNER_READ WORLD_READ)
+INSTALL(FILES etc-resourced.mount DESTINATION /etc/isu/resourced/system-services/ PERMISSIONS OWNER_WRITE OWNER_READ WORLD_READ)
+
+IF(USE_32BIT)
+ INSTALL(FILES usr-lib-resourced-plugins.mount DESTINATION /etc/isu/resourced/system-services/ PERMISSIONS OWNER_WRITE OWNER_READ WORLD_READ)
+ELSEIF(USE_64BIT)
+ INSTALL(FILES usr-lib-resourced-plugins.mount DESTINATION /etc/isu/resourced/system-services/ RENAME usr-lib64-resourced-plugins.mount PERMISSIONS OWNER_WRITE OWNER_READ WORLD_READ)
+ENDIF()
--- /dev/null
+[Unit]
+Before=local-fs.target
+ConditionPathIsMountPoint=!/etc/resourced
+DefaultDependencies=no
+
+[Mount]
+What=#ISU_RUN_PATH#/resourced/rootfs/etc/resourced
+Where=/etc/resourced
+Options=defaults,relatime,bind,ro
--- /dev/null
+[isu]
+name=#NAME#
+version=#VERSION#
+system_service=resourced.service ##PLUGIN_MOUNT## etc-resourced.mount
+
+[files]
+/usr/bin/resourced
+/etc/resourced
+-##LIBDIR##/resourced/plugins
+##LIBDIR##/libresourced-private-api.so.*
--- /dev/null
+[Unit]
+Description=Resource management daemon
+# resourced monitors AUL (lauchpad) d-bus signals to learn about existence
+# and the state of applications. Consequently, it has to start before
+# launchpad to have knowledge of all applications. The Before= line below
+# refers to user-sessions, because tlm, and consequently user@.service
+# starts after user-sessions are allowed.
+After=##PLUGIN_MOUNT##
+Before=systemd-user-sessions.service
+BindsTo=##PLUGIN_MOUNT##
+DefaultDependencies=no
+Requires=resourced.socket
+
+[Service]
+Type=simple
+SmackProcessLabel=System
+ExecStart=#ISU_RUN_PATH#/resourced/rootfs/usr/bin/resourced
+MemoryLimit=50M
+Restart=on-failure
+RestartSec=0
+
+[Install]
+WantedBy=multi-user.target
--- /dev/null
+[Unit]
+Before=local-fs.target
+After=etc-resourced.mount
+BindsTo=etc-resourced.mount
+ConditionPathIsMountPoint=!##PLUGIN_LIB_DIR##
+DefaultDependencies=no
+
+[Mount]
+What=#ISU_RUN_PATH#/resourced/rootfs##PLUGIN_LIB_DIR##
+Where=##PLUGIN_LIB_DIR##
+Options=defaults,relatime,bind,ro
%description watchdog-handler
%endif
+%package isu
+Summary: ISU package for resourced
+Group: Application Framework/Service
+
+%description isu
+Configuration files to generate the ISU (Individual Service Upgrade) package
+
%prep
%setup -q
+%ifarch %{arm} %ix86
+%define ISU_ARCH_BIT 32
+%else
+%define ISU_ARCH_BIT 64
+%endif
+
%build
mkdir -p build
pushd build
%cmake .. -DFULLVER=%{version} \
-DCMAKE_BUILD_TYPE=Release \
+ -DISU_ARCH_BIT=%{ISU_ARCH_BIT} \
-DCPU_THROTTLING_MODULE=%{cpu_throttling_module} \
-DCPU_BOOSTING_MODULE=%{cpu_boosting_module} \
-DMEMORY_MODULE=%{memory_module} \
make %{?jobs:-j%jobs}
popd
+LIB_DIR=%{_libdir}
+sed -ie s,"##LIBDIR##,$LIB_DIR,g" isu/isu.cfg
+RD_PLUGIN_PATH=%{plugindir}
+RD_PLUGIN_MOUNT_NAME=$(systemd-escape $RD_PLUGIN_PATH).mount
+RD_PLUGIN_MOUNT_NAME=$(cut -c2- <<< $RD_PLUGIN_MOUNT_NAME) > /dev/null
+sed -ie s,"##PLUGIN_MOUNT##,$RD_PLUGIN_MOUNT_NAME,g" isu/isu.cfg
+sed -ie s,"##PLUGIN_MOUNT##,$RD_PLUGIN_MOUNT_NAME,g" isu/resourced.service
+sed -ie s,"##PLUGIN_LIB_DIR##,$RD_PLUGIN_PATH,g" isu/usr-lib-resourced-plugins.mount
+
%install
rm -rf %{buildroot}
pushd build
%manifest resourced.manifest
%{_libdir}/libresourced-private-api.so.*
%{_bindir}/resourced
+%dir %{plugindir}
%attr(-,root, root) %{_bindir}/resourced
%attr(700, root, root) %{TZ_SYS_ETC}/dump.d/module.d/dump_heart_data.sh
%defattr(-,root,root)
%{_libdir}/resourced-tests/run_tests.sh
%{_libdir}/resourced-tests/watchdog-test
+
+%files isu
+/etc/isu/resourced/*
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/resourced-private-api.pc.in ${CMAKE_SOURCE_DIR}/resourced-private-api.pc @ONLY)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/resourced-private-api.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+INSTALL(DIRECTORY DESTINATION ${MAKE_INSTALL_PREFIX}${RD_PLUGIN_PATH})
+
ADD_LIBRARY(plugin-resourced-process-block MODULE
${BLOCK_SOURCE_DIR}/block.c
${BLOCK_SOURCE_DIR}/block-monitor.c)