Add ISU Package 53/292953/9
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>
Tue, 16 May 2023 08:35:56 +0000 (10:35 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Mon, 10 Jul 2023 15:36:43 +0000 (17:36 +0200)
Change-Id: Ia0c6b6de39194c8e8522888c683904b762a6116c

Makefile.am
isu/isu.cfg [new file with mode: 0644]
isu/system-services/dlog_logger.service [new file with mode: 0644]
packaging/dlog.spec

index 9d1a02b..ec72bba 100644 (file)
@@ -970,6 +970,11 @@ docdir = $(datadir)/doc/dlog
 doc_DATA = \
        README.testsuite
 
 doc_DATA = \
        README.testsuite
 
+isudir = /etc/isu/dlog/
+isu_DATA = isu/isu.cfg
+isusystemservicedir = /etc/isu/dlog/system-services/
+isusystemservice_DATA = isu/system-services/dlog_logger.service
+
 dox::
        doxygen
 
 dox::
        doxygen
 
diff --git a/isu/isu.cfg b/isu/isu.cfg
new file mode 100644 (file)
index 0000000..1b0ef1a
--- /dev/null
@@ -0,0 +1,8 @@
+[isu]
+name=#NAME#
+version=#VERSION#
+system_service=dlog_logger.service
+
+[files]
+/usr/bin/dlog_logger
+
diff --git a/isu/system-services/dlog_logger.service b/isu/system-services/dlog_logger.service
new file mode 100644 (file)
index 0000000..70f5be3
--- /dev/null
@@ -0,0 +1,44 @@
+[Unit]
+Description=dlog logging service
+Requires=local-fs.target
+After=systemd-tmpfiles-setup.service local-fs.target
+Before=basic.target
+DefaultDependencies=no
+
+# Note:
+# Requires=/After= are added dynamically via dlog-unit-generator (see systemd.generator(7)) if logger
+# devices are available.  This is required as dlog_logger has to have devices available and with proper
+# permissions being set before it starts (as we run as 'log' user).
+
+[Service]
+Type=notify
+#
+# Setting TZ prevents logger from repeatedly statting /etc/localtime
+# each time it wanted a timestamp, increasing performance (glibc feature).
+# However, there is a tradeoff as it also sets the timezone in stone.
+#
+# We accept the tradeoff as without caching dlog_logger will be A LOT
+# slower (eg. 30-60% slower). If you dare to touch setting below, be
+# prepared to show vallgrind callgrind and perf data showing the
+# performance penalty.
+Environment=TZ=:/etc/localtime
+NotifyAccess=all
+User=log
+Group=log
+SmackProcessLabel=System
+EnvironmentFile=/etc/isu/service-common.inc
+ExecStart=/bin/isu-sandbox $ISU_SANDBOX_INVOCATION \
+                     --bind #ISU_RUN_PATH#/dlog/rootfs/usr/bin/dlog_logger /usr/bin/dlog_logger \
+                     --cap-add CAP_SYSLOG \
+                     /usr/bin/dlog_logger
+AmbientCapabilities=CAP_SETFCAP CAP_SETUID CAP_SETGID
+SecureBits=keep-caps
+Restart=on-failure
+LimitNOFILE=16384
+Nice=1
+StandardOutput=journal+console
+StandardError=journal+console
+
+[Install]
+WantedBy=basic.target
+
index 516ca8f..6fbffd6 100644 (file)
@@ -68,6 +68,7 @@ Summary:    Logger service
 License:    Apache-2.0
 Group:      Development/Libraries
 Requires:   %{name} = %{version}-%{release}
 License:    Apache-2.0
 Group:      Development/Libraries
 Requires:   %{name} = %{version}-%{release}
+Requires:   %{name}-isu = %{version}-%{release}
 Requires:   pkgconf(gio-2.0)
 %description logger
 
 Requires:   pkgconf(gio-2.0)
 %description logger
 
@@ -124,6 +125,8 @@ Group:    Development/Libraries
 This package contains gcov code coverage/profiling files for libdlog.
 %endif
 
 This package contains gcov code coverage/profiling files for libdlog.
 %endif
 
+%isu_package
+
 %prep
 %setup -q
 
 %prep
 %setup -q