Commit 52696f99 authored by OPNA2608's avatar OPNA2608 Committed by Weijia Wang
Browse files

lomiri.libusermetrics: Add custom patch for launching systemd service

The UserMetrics service expects AppArmor to be available, and its database access breaks when that's not the case.
Details: https://gitlab.com/ubports/development/core/libusermetrics/-/issues/8

We need to set an envvar for it to work AppArmor-less, but that requires system config knowledge.
Solve this by telling the D-Bus service to look for & launch a systemd service, which we will later create in the Lomiri module.
parent 9c5e9db5
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
From cf8ba54d22f5ac839004c0d984fb402bde82b527 Mon Sep 17 00:00:00 2001
From: OPNA2608 <opna2608@protonmail.com>
Date: Mon, 8 Apr 2024 15:22:55 +0200
Subject: [PATCH] Launch module-created systemd service

---
 data/com.lomiri.UserMetrics.service.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/data/com.lomiri.UserMetrics.service.in b/data/com.lomiri.UserMetrics.service.in
index c2e6ae1..212e24f 100644
--- a/data/com.lomiri.UserMetrics.service.in
+++ b/data/com.lomiri.UserMetrics.service.in
@@ -3,3 +3,4 @@ Name=com.lomiri.UserMetrics
 Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/libusermetrics/usermetricsservice
 User=usermetrics
 StandardOutput=syslog
+SystemdService=dbus-com.lomiri.UserMetrics.service
-- 
2.42.0
+5 −0
Original line number Diff line number Diff line
@@ -43,6 +43,10 @@ stdenv.mkDerivation (finalAttrs: {
  patches = [
    # Not submitted yet, waiting for decision on how CMake testing should be handled
    ./2001-Remove-custom-check-target.patch

    # Due to https://gitlab.com/ubports/development/core/libusermetrics/-/issues/8, we require knowledge about AppArmor availability at launch time
    # Custom patch to launch a module-defined service that can handle this
    ./2002-Launch-module-created-systemd-service.patch
  ];

  postPatch = ''
@@ -91,6 +95,7 @@ stdenv.mkDerivation (finalAttrs: {
  cmakeFlags = [
    (lib.cmakeBool "GSETTINGS_LOCALINSTALL" true)
    (lib.cmakeBool "GSETTINGS_COMPILE" true)
    (lib.cmakeBool "ENABLE_CLICK" true)
    (lib.cmakeBool "ENABLE_TESTS" finalAttrs.finalPackage.doCheck)
    (lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" (lib.concatStringsSep ";" [
      # Exclude tests