Enable modes.path systemd service for undo.xml files
authorJinWang An <jinwang.an@samsung.com>
Fri, 15 Nov 2019 05:44:23 +0000 (14:44 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Wed, 18 Mar 2020 08:53:50 +0000 (17:53 +0900)
packaging/modes.spec
supervisor/CMakeLists.txt
supervisor/modes.path.in [new file with mode: 0644]

index 4076a9a79cb9bf68d277004d29ee7e2199287f76..469ffe22f9cef054babf1bc36853cab5fbccfc6a 100644 (file)
@@ -106,6 +106,8 @@ install -m 0644 example/mode/*invalid*_mode.xml %{buildroot}%{modes_test_dir}/
 install -m 0644 example/rule/*fail*_rule.xml %{buildroot}%{modes_test_dir}/
 install -m 0755 unittest/modes-gtest-run.sh %{buildroot}%{modes_test_dir}/
 
+%install_service multi-user.target.wants %{name}.path
+
 %check
 xmllint --noout --schema schema/tizen_mode.xsd example/mode/tizen_*_mode.xml
 xmllint --noout --schema schema/tizen_action_rule.xsd example/rule/tizen_*_rule.xml
@@ -113,11 +115,14 @@ bash ./unittest/modes-gtest-run.sh ./example ./unittest
 
 %post
 /sbin/ldconfig
+#For Development
 systemctl daemon-reload
-systemctl restart %{name}.service
+systemctl try-restart %{name}.path
+systemctl try-restart %{name}.service
 
 %posttrans unittests
-systemctl restart %{name}.service
+systemctl try-restart %{name}.path
+systemctl try-restart %{name}.service
 %{modes_test_dir}/modes-gtest-run.sh %{modes_data_dir} %{modes_test_dir}
 
 %preun unittests
@@ -126,12 +131,15 @@ rm -rf %{modes_test_dir}/*ex*.xml %{modes_test_dir}/*.xsd %{modes_test_dir}/extr
 %postun -p /sbin/ldconfig
 
 %postun unittests
-systemctl restart %{name}.service
+systemctl try-restart %{name}.path
+systemctl try-restart %{name}.service
 
 %files
 %manifest %{name}.manifest
 %{_bindir}/mode-supervisor
 %{_unitdir}/%{name}.service
+%{_unitdir}/%{name}.path
+%{_unitdir}/multi-user.target.wants/%{name}.path
 %{_sysconfdir}/dbus-1/system.d/%{_dbus_interface}.conf
 %{_datadir}/dbus-1/system-services/%{_dbus_interface}.service
 %{modes_data_dir}/schema/*
index 11355cc598414516582cdd67ba131d0538e2c587..0935bf49a59bf549bf51ca6f82b1c82e2519aa4f 100644 (file)
@@ -26,8 +26,10 @@ TARGET_LINK_LIBRARIES(${DAEMON} ${daemon_pkgs_LIBRARIES} dl)
 CONFIGURE_FILE(${DBUS_INTERFACE}.service.in ${DBUS_INTERFACE}.service @ONLY)
 CONFIGURE_FILE(${DBUS_INTERFACE}.conf.in ${DBUS_INTERFACE}.conf @ONLY)
 CONFIGURE_FILE(${PROJECT_NAME}.service.in ${PROJECT_NAME}.service @ONLY)
+CONFIGURE_FILE(${PROJECT_NAME}.path.in ${PROJECT_NAME}.path @ONLY)
 
 INSTALL(TARGETS ${DAEMON} DESTINATION ${BIN_INSTALL_DIR})
 INSTALL(FILES ${PROJECT_NAME}.service DESTINATION ${SYSTEMD_DIR})
+INSTALL(FILES ${PROJECT_NAME}.path DESTINATION ${SYSTEMD_DIR})
 INSTALL(FILES ${DBUS_INTERFACE}.conf DESTINATION ${SYSCONF_DIR}/dbus-1/system.d)
 INSTALL(FILES ${DBUS_INTERFACE}.service DESTINATION ${SHARE_INSTALL_PREFIX}/dbus-1/system-services)
diff --git a/supervisor/modes.path.in b/supervisor/modes.path.in
new file mode 100644 (file)
index 0000000..ecd7420
--- /dev/null
@@ -0,0 +1,8 @@
+[Unit]
+Description=modes undo xml files
+
+[Path]
+DirectoryNotEmpty=@MODES_UNDO_INFO_DEFAULT_DIR@
+
+[Install]
+WantedBy=multi-user.target