From cc8579e3d0ec7d21719018ff16a8a3dc730f3349 Mon Sep 17 00:00:00 2001
From: Bart Ribbers <bribbers@disroot.org>
Date: Wed, 25 Sep 2024 14:05:48 +0200
Subject: [PATCH] extra-repos/systemd/systemd-services: take over service files
 from origin packages (MR 5631)

We were only forking kactivitymanagerd and kglobalacceld for their
service files
---
 .../systemd/kactivitymanagerd/APKBUILD        | 54 -----------------
 extra-repos/systemd/kglobalacceld/APKBUILD    | 59 -------------------
 extra-repos/systemd/systemd-services/APKBUILD | 10 +++-
 .../user-plasma-kactivitymanagerd.service     |  9 +++
 .../user-plasma-kglobalaccel.service          | 12 ++++
 5 files changed, 30 insertions(+), 114 deletions(-)
 delete mode 100644 extra-repos/systemd/kactivitymanagerd/APKBUILD
 delete mode 100644 extra-repos/systemd/kglobalacceld/APKBUILD
 create mode 100644 extra-repos/systemd/systemd-services/user-plasma-kactivitymanagerd.service
 create mode 100644 extra-repos/systemd/systemd-services/user-plasma-kglobalaccel.service

diff --git a/extra-repos/systemd/kactivitymanagerd/APKBUILD b/extra-repos/systemd/kactivitymanagerd/APKBUILD
deleted file mode 100644
index 421e1836524..00000000000
--- a/extra-repos/systemd/kactivitymanagerd/APKBUILD
+++ /dev/null
@@ -1,54 +0,0 @@
-# Forked from Alpine to add systemd!
-
-pkgname=kactivitymanagerd
-pkgver=99996.1.5
-_pkgver=6.1.5
-pkgrel=0
-pkgdesc="System service to manage user's activities and track the usage patterns"
-# armhf blocked by qt6-qtdeclarative
-arch="all !armhf !armv7"
-url="https://kde.org/plasma-desktop/"
-license="GPL-2.0-only OR GPL-3.0-only"
-depends="qt6-qtbase-sqlite"
-makedepends="
-	boost-dev
-	extra-cmake-modules
-	kconfig-dev
-	kcoreaddons-dev
-	kdbusaddons-dev
-	kglobalaccel-dev
-	ki18n-dev
-	kio-dev
-	kwindowsystem-dev
-	kxmlgui-dev
-	qt6-qtbase-dev
-	samurai
-	"
-
-case "$pkgver" in
-	*.90*) _rel=unstable;;
-	*) _rel=stable;;
-esac
-subpackages="$pkgname-lang $pkgname-systemd"
-_repo_url="https://invent.kde.org/plasma/kactivitymanagerd.git"
-source="https://download.kde.org/stable/plasma/$_pkgver/kactivitymanagerd-$_pkgver.tar.xz"
-builddir="$srcdir/$pkgname-$_pkgver"
-
-build() {
-	cmake -B build -G Ninja \
-		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-		-DCMAKE_INSTALL_PREFIX=/usr \
-		-DCMAKE_INSTALL_LIBDIR=lib
-	cmake --build build
-}
-
-check() {
-	ctest --test-dir build --output-on-failure
-}
-
-package() {
-	DESTDIR="$pkgdir" cmake --install build
-}
-sha512sums="
-e3720e53cd37375828d67ddfc873cc465eb4a0ccbf75b066bf98927752df2465f382cfa5cca3f340200f6c86a91087b0157de82b581a5f06bbe77b488909f417  kactivitymanagerd-6.1.5.tar.xz
-"
diff --git a/extra-repos/systemd/kglobalacceld/APKBUILD b/extra-repos/systemd/kglobalacceld/APKBUILD
deleted file mode 100644
index 75bd1c4fb87..00000000000
--- a/extra-repos/systemd/kglobalacceld/APKBUILD
+++ /dev/null
@@ -1,59 +0,0 @@
-# Forked from Alpine to add systemd!
-
-pkgname=kglobalacceld
-pkgver=99996.1.5
-_pkgver=6.1.5
-pkgrel=0
-pkgdesc="Daemon providing Global Keyboard Shortcut (Accelerator) functionality"
-# armhf blocked by extra-cmake-modules
-arch="all !armhf"
-url="https://invent.kde.org/plasma/kglobalacceld"
-license="LGPL-2.0-or-later AND LGPL-2.0-only AND LGPL-2.1-or-later"
-depends_dev="$pkgname
-	kconfig-dev
-	kcoreaddons-dev
-	kcrash-dev
-	kdbusaddons-dev
-	kglobalaccel-dev
-	kio-dev
-	knotifications-dev
-	kservice-dev
-	kwindowsystem-dev
-	qt6-qtbase-dev
-	xcb-util-keysyms-dev
-	"
-makedepends="$depends_dev
-	doxygen
-	extra-cmake-modules
-	graphviz
-	qt6-qttools-dev
-	samurai
-	"
-checkdepends="
-	dbus
-	xvfb-run
-	"
-subpackages="$pkgname-dev $pkgname-systemd"
-_repo_url="https://invent.kde.org/plasma/kglobalacceld.git"
-source="https://download.kde.org/stable/plasma/$_pkgver/kglobalacceld-$_pkgver.tar.xz"
-
-builddir="$srcdir/$pkgname-$_pkgver"
-
-build() {
-	cmake -B build -G Ninja \
-		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-		-DCMAKE_INSTALL_PREFIX=/usr \
-		-DCMAKE_INSTALL_LIBDIR=lib
-	cmake --build build
-}
-
-check() {
-	dbus-run-session -- xvfb-run -a ctest --test-dir build --output-on-failure -E "shortcutstest"
-}
-
-package() {
-	DESTDIR="$pkgdir" cmake --install build
-}
-sha512sums="
-7557c6d6563d332c7b02754ee0c0f72f7595b2622ed20a7b562fc489c5a2b5895d54b8146dfd9bd94679e0d1fb6d04510eb779f2d7c74cb6a83b1e3b5f76a429  kglobalacceld-6.1.5.tar.xz
-"
diff --git a/extra-repos/systemd/systemd-services/APKBUILD b/extra-repos/systemd/systemd-services/APKBUILD
index ad2e4f4008a..b467574536a 100644
--- a/extra-repos/systemd/systemd-services/APKBUILD
+++ b/extra-repos/systemd/systemd-services/APKBUILD
@@ -6,7 +6,7 @@
 # How to add a new service file (5 steps):
 pkgname=systemd-services
 # 1. bump pkgver
-pkgver=21
+pkgver=22
 pkgrel=0
 pkgdesc="Systemd service files"
 url="https://postmarketos.org"
@@ -39,6 +39,8 @@ subpackages="
 	openssh-server-pam-systemd:_service
 	pd-mapper-systemd:_service
 	phosh-systemd:_service
+	plasma-kactivitymanagerd:_service
+	plasma-kglobalacceld:_service
 	plasma-mobile-systemd:_service
 	q6voiced-systemd:_service
 	qbootctl-systemd:_service
@@ -87,6 +89,8 @@ _nftables_sources="system/nftables.service"
 _openssh_server_pam_sources="system/sshd.service system/sshdgenkeys.service"
 _pd_mapper_sources="system/pd-mapper.service"
 _phosh_sources="system/phosh.service"
+_plasma_kactivitymanagerd_sources="user/plasma-kactivitymanagerd.service"
+_plasma_kglobalacceld_sources="user/plasma-kglobalaccel.service"
 _plasma_mobile_sources="system/plasma-mobile.service"
 _q6voiced_sources="system/q6voiced.service"
 _qbootctl_sources="system/qbootctl.service"
@@ -136,6 +140,8 @@ source="$(flatpath \
 	$_openssh_server_pam_sources \
 	$_pd_mapper_sources \
 	$_phosh_sources \
+	$_plasma_kactivitymanagerd_sources \
+	$_plasma_kglobalacceld_sources \
 	$_plasma_mobile_sources \
 	$_q6voiced_sources \
 	$_qbootctl_sources \
@@ -245,6 +251,8 @@ fa445c4a53214524baed4e9c52a5463592a074f88a5a286eacb60d0907c0545f725afde23abd68cf
 c0badea3905c1d53d213fbfe11d25b556a2e484fe77eb50e9f4d42e25b67b56a0804e7d8e1b7731cd280cbb3525b4c60311817609381e2308d9f2dfb7c0d7072  system-sshdgenkeys.service
 0bed9a8a719661609ad84d1c6fcdf2fe9213e741682b7ddebad82d9744f137c593788ed522868f10b95b599d81743d07ec3212630a7e99d333261dfa1bf1cc11  system-pd-mapper.service
 5f53e07a48c64ab27deead4c1dc64dbea048de5632026d131e27e0fc3115723a1138d043199e2fdba9a281c420b3286a0aa96b063ed7f02c1153487ef732dd98  system-phosh.service
+9cf877929b16f3437e65d1a0a2049799cc97cc84a7caab6a581e90139495b4febb5fb4c59ee463110866a0b60c9462d6d0fdb331d92d29b30ce6aeada365ac48  user-plasma-kactivitymanagerd.service
+acf21c4391ca62775491ba4d3b7c460b4163ef07abb195e152c98299a2d12779f3eb95f8cad0aeb3239f2d0fa8222a2483000c45aa6a47e05269876147d89839  user-plasma-kglobalaccel.service
 e12d8e98e28a795f879aebcceb32a991ee4abcb3bc5ec458aa5378bb52ff86cf39be04bc4a196925f532d623304b3005f561fa5e55d1c87944d718058ec4c0e6  system-plasma-mobile.service
 4c4c3f1e5e829ff67dd35df59120ab59730ff1f1ca0aab93f16d670132979a99099fad59e6c736908cc19df9172c9bdfe476ec721a1cc28de8c2210da46ce1f1  system-q6voiced.service
 621189aa251655796795f4fa0cd79360bb67573e7327e545064eaadafc83cc7b382a405d6ba80662e0a4ece3876e4270e3563d859a6ba63b5e3854b39c35873e  system-qbootctl.service
diff --git a/extra-repos/systemd/systemd-services/user-plasma-kactivitymanagerd.service b/extra-repos/systemd/systemd-services/user-plasma-kactivitymanagerd.service
new file mode 100644
index 00000000000..bc97e2bcea6
--- /dev/null
+++ b/extra-repos/systemd/systemd-services/user-plasma-kactivitymanagerd.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=KActivityManager Activity manager Service
+PartOf=graphical-session.target
+Before=graphical-session.target
+
+[Service]
+ExecStart=/usr/lib/libexec/kactivitymanagerd
+BusName=org.kde.ActivityManager
+Slice=background.slice
diff --git a/extra-repos/systemd/systemd-services/user-plasma-kglobalaccel.service b/extra-repos/systemd/systemd-services/user-plasma-kglobalaccel.service
new file mode 100644
index 00000000000..da39fa317c8
--- /dev/null
+++ b/extra-repos/systemd/systemd-services/user-plasma-kglobalaccel.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=KDE Global Shortcuts Server
+PartOf=graphical-session.target
+
+[Service]
+ExecStart=/usr/lib/libexec/kglobalacceld
+BusName=org.kde.kglobalaccel
+Slice=background.slice
+TimeoutSec=5sec
+Restart=on-failure
+# Exit status 1 is used when the X11 connection drops
+RestartPreventExitStatus=1
-- 
GitLab