From 4056b4f128c64e496502a735b2b9e35dfdeb2c1f Mon Sep 17 00:00:00 2001
From: Stefan Hansson <newbie13xd@gmail.com>
Date: Fri, 27 Oct 2023 13:58:49 +0200
Subject: [PATCH] pine64-pinephone: remove gpsd config

This is no longer necessary as geoclue now can talk to ModemManager
directly for GPS information. It also presents a security risk due to
how gpsd works. As such, remove it.

Closes https://gitlab.com/postmarketOS/pmaports/-/issues/2340
---
 device/main/device-pine64-pinephone/APKBUILD       | 14 ++------------
 .../device-pine64-pinephone.post-install           |  2 --
 .../device-pine64-pinephone.post-upgrade           |  2 ++
 .../device-pine64-pinephone/gpsd_device-hook.sh    | 10 ----------
 .../device-pine64-pinephone/gpsd_pinephone.initd   | 13 -------------
 5 files changed, 4 insertions(+), 37 deletions(-)
 delete mode 100644 device/main/device-pine64-pinephone/gpsd_device-hook.sh
 delete mode 100644 device/main/device-pine64-pinephone/gpsd_pinephone.initd

diff --git a/device/main/device-pine64-pinephone/APKBUILD b/device/main/device-pine64-pinephone/APKBUILD
index d72dfd347b7..69a03b91dc4 100644
--- a/device/main/device-pine64-pinephone/APKBUILD
+++ b/device/main/device-pine64-pinephone/APKBUILD
@@ -3,8 +3,8 @@
 # Co-Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
 # Co-Maintainer: Dylan Van Assche <me@dylanvanassche.be>
 pkgname=device-pine64-pinephone
-pkgver=0.46
-pkgrel=3
+pkgver=0.47
+pkgrel=0
 pkgdesc="PINE64 PinePhone"
 url="https://postmarketos.org"
 license="MIT"
@@ -28,7 +28,6 @@ depends="
 	atinout
 	eg25-manager
 	eg25-manager-openrc
-	gpsd
 	iw
 	linux-postmarketos-allwinner>=5.14
 	mesa-egl
@@ -52,8 +51,6 @@ source="
 	UPower.conf
 	deviceinfo
 	modules-initfs
-	gpsd_device-hook.sh
-	gpsd_pinephone.initd
 	hwtest.ini
 	kirigami-lowpower.sh
 	kxkbrc
@@ -131,11 +128,6 @@ package() {
 	install -Dm644 "$srcdir"/hwtest.ini \
 		"$pkgdir"/usr/share/hwtest.ini
 
-	# GPS
-	install -Dm755 "$srcdir"/gpsd_pinephone.initd \
-		"$pkgdir"/etc/init.d/gpsd_pinephone
-	install -Dm755 "$srcdir"/gpsd_device-hook.sh \
-		"$pkgdir"/etc/gpsd/device-hook
 	install -D -m644 "$srcdir"/10-pinephone-proximity.rules \
 		"$pkgdir"/usr/lib/udev/rules.d/10-pinephone-proximity.rules
 	install -Dm644 "$srcdir"/60-flashlight.rules -t "$pkgdir"/usr/lib/udev/rules.d/
@@ -257,8 +249,6 @@ bac664c504d9a3adc6e3d25f24ac63cf7c449a82374544a5b56c259dc25af580897b9dc992865ac8
 ed0e03f7e1c0348c06be9a7922414469245604ce813bbf0c8910ef211cb993bbb0d0d4615c9c961d50712415f85d6b73e0cf02780ac784666aac56e4889341e4  UPower.conf
 87751806329118272bc887691a0d5b588fa7a601fb048594785032a661b7e48a86c9d97f8bfa99edf247051a81799f2e628e5bf7c129cf2919c2abf0c146e031  deviceinfo
 218d1361622418a0f79bd661a601baf586aec3995cf32304399b47664caf92bac006466ae1e59afa90f6ab4b9ed6acd16147a696fffd0dcab2492e2428ecc0b0  modules-initfs
-348a1c4b82ffb8d2535b9a659f20d1ebd9a34a6eb8ead1016012c680de6cca401e1883319b2c0206063eb316f0dec274877fb66ee28869592ebea1f10b7b11da  gpsd_device-hook.sh
-1017fc3f325227da58c77abdc59e9735288d91a7ccc63ec784fe0241c523786b617a11ce8045dab2a74ca12a7dd70aaa334af91836418db1e96a3266fecaa4fd  gpsd_pinephone.initd
 3dd6d612c381cb0002049d1974d8fb5aa5a53a1eb4d6bcbf62eb2ad52cfdc45f0f6ad24a699716d3513b0371aa1316f25dc72afc10d7176cc3b99d0965c3f030  hwtest.ini
 6bc22b369b2d9058b702ac7a7862abaefaf8179b43491868bdb008d181b59104f1ded89db1da51a810e1ccdc803a579b924a438674283a65afc3a9c4d2894caf  kirigami-lowpower.sh
 03d547ece68445579352d0419bf16a43ca1c567c1b0b14a977982cc8adddd34f1f8e8691465f1420091a5d33fa50daaefcee404d9d4b89e7598c4ad43a72469e  kxkbrc
diff --git a/device/main/device-pine64-pinephone/device-pine64-pinephone.post-install b/device/main/device-pine64-pinephone/device-pine64-pinephone.post-install
index 2f9fd7b515a..73f2579850b 100644
--- a/device/main/device-pine64-pinephone/device-pine64-pinephone.post-install
+++ b/device/main/device-pine64-pinephone/device-pine64-pinephone.post-install
@@ -1,5 +1,3 @@
 #!/bin/sh
 
 rc-update add eg25-manager default
-rc-update add gpsd default
-rc-update add gpsd_pinephone default
diff --git a/device/main/device-pine64-pinephone/device-pine64-pinephone.post-upgrade b/device/main/device-pine64-pinephone/device-pine64-pinephone.post-upgrade
index 73f2579850b..0152db469e5 100644
--- a/device/main/device-pine64-pinephone/device-pine64-pinephone.post-upgrade
+++ b/device/main/device-pine64-pinephone/device-pine64-pinephone.post-upgrade
@@ -1,3 +1,5 @@
 #!/bin/sh
 
 rc-update add eg25-manager default
+rc-update -qq del gpsd || true
+rc-update -qq del gpsd_pinephone || true
diff --git a/device/main/device-pine64-pinephone/gpsd_device-hook.sh b/device/main/device-pine64-pinephone/gpsd_device-hook.sh
deleted file mode 100644
index a248aade990..00000000000
--- a/device/main/device-pine64-pinephone/gpsd_device-hook.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-if [ "$2" == "ACTIVATE" ]; then
-	echo "AT+QGPS=1" | atinout - /dev/EG25.AT -
-elif [ "$2" == "DEACTIVATE" ]; then
-	echo "AT+QGPSEND" | atinout - /dev/EG25.AT -
-else
-	echo "Unhandled argument: $2"
-	exit 1
-fi
diff --git a/device/main/device-pine64-pinephone/gpsd_pinephone.initd b/device/main/device-pine64-pinephone/gpsd_pinephone.initd
deleted file mode 100644
index 74eb62ee15d..00000000000
--- a/device/main/device-pine64-pinephone/gpsd_pinephone.initd
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/sbin/openrc-run
-
-depend() {
-	after gpsd
-}
-
-start() {
-	gpsdctl add /dev/EG25.NMEA
-}
-
-stop() {
-	gpsdctl remove /dev/EG25.NMEA
-}
-- 
GitLab