summaryrefslogtreecommitdiffstats
path: root/meta-agl-profile-core/recipes-multimedia/lightmediascanner/files
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-07-22 23:26:40 +0300
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-07-24 22:20:02 +0000
commitaf1c6967f09a51c600742de6e299255ff07b4a47 (patch)
tree21728ffc9603eeda68bb41a8f59ffbd163fa1f37 /meta-agl-profile-core/recipes-multimedia/lightmediascanner/files
parent07af9fef1e30e5220a940c2c7e19e4bc50b9b456 (diff)
recipes-multimedia: lightmediascanner: switch from user dbus session to system
To avoid multiple instances of lightmediascanner from being created it should run only once in the system dbus session. Bug-AGL: SPEC-2655 Change-Id: I6c9510926f82ec9eb5625d63d08998a145504227 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'meta-agl-profile-core/recipes-multimedia/lightmediascanner/files')
-rw-r--r--meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/0002-switch-from-G_BUS_TYPE_SESSION-to-G_BUS_TYPE_SYSTEM.patch49
-rw-r--r--meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/dbus-lightmediascanner.conf7
-rw-r--r--meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/lightmediascanner.service5
3 files changed, 58 insertions, 3 deletions
diff --git a/meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/0002-switch-from-G_BUS_TYPE_SESSION-to-G_BUS_TYPE_SYSTEM.patch b/meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/0002-switch-from-G_BUS_TYPE_SESSION-to-G_BUS_TYPE_SYSTEM.patch
new file mode 100644
index 000000000..5abb980b8
--- /dev/null
+++ b/meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/0002-switch-from-G_BUS_TYPE_SESSION-to-G_BUS_TYPE_SYSTEM.patch
@@ -0,0 +1,49 @@
+From 5a618b444e424483c3a9d34dd9b196796cac8e3f Mon Sep 17 00:00:00 2001
+From: Matt Ranostay <matt.ranostay@konsulko.com>
+Date: Mon, 22 Jul 2019 13:29:52 -0700
+Subject: [PATCH] switch from G_BUS_TYPE_SESSION to G_BUS_TYPE_SYSTEM
+
+Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
+---
+ src/bin/lightmediascannerctl.c | 4 ++--
+ src/bin/lightmediascannerd.c | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/bin/lightmediascannerctl.c b/src/bin/lightmediascannerctl.c
+index 5764bc0..1d4d844 100644
+--- a/src/bin/lightmediascannerctl.c
++++ b/src/bin/lightmediascannerctl.c
+@@ -11,7 +11,7 @@ start_service_by_name(void)
+ GVariant *var;
+ GDBusConnection *conn;
+
+- conn = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
++ conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (error) {
+ fprintf(stderr, "Could not get session bus connection: %s\n",
+ error->message);
+@@ -526,7 +526,7 @@ main(int argc, char *argv[])
+
+ app.timer = NULL;
+ app.loop = g_main_loop_new(NULL, FALSE);
+- app.proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
++ app.proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.lightmediascanner",
+diff --git a/src/bin/lightmediascannerd.c b/src/bin/lightmediascannerd.c
+index 319db42..6db81cc 100644
+--- a/src/bin/lightmediascannerd.c
++++ b/src/bin/lightmediascannerd.c
+@@ -1721,7 +1721,7 @@ main(int argc, char *argv[])
+ introspection_data = g_dbus_node_info_new_for_xml(introspection_xml, NULL);
+ g_assert(introspection_xml != NULL);
+
+- id = g_bus_own_name(G_BUS_TYPE_SESSION, "org.lightmediascanner",
++ id = g_bus_own_name(G_BUS_TYPE_SYSTEM, "org.lightmediascanner",
+ G_BUS_NAME_OWNER_FLAGS_NONE,
+ NULL, on_name_acquired, NULL, NULL, NULL);
+
+--
+2.20.1
+
diff --git a/meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/dbus-lightmediascanner.conf b/meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/dbus-lightmediascanner.conf
index 9cb321ba9..8a9e35b09 100644
--- a/meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/dbus-lightmediascanner.conf
+++ b/meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/dbus-lightmediascanner.conf
@@ -1,7 +1,12 @@
<?xml version="1.0"?> <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
- <policy context="default">
+ <policy user="root">
+ <allow own="org.lightmediascanner"/>
<allow send_destination="org.lightmediascanner"/>
<allow receive_type="signal" receive_sender="org.lightmediascanner" receive_interface="org.freedesktop.DBus.Properties"/>
</policy>
+
+ <policy at_console="true">
+ <allow send_destination="org.lightmediascanner"/>
+ </policy>
</busconfig>
diff --git a/meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/lightmediascanner.service b/meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/lightmediascanner.service
index 3b8a6d361..b75e19e25 100644
--- a/meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/lightmediascanner.service
+++ b/meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/lightmediascanner.service
@@ -5,8 +5,9 @@ Description=Lightmediascanner (LMS)
Type=dbus
BusName=org.lightmediascanner
UMask=0077
-ExecStart=/usr/bin/lightmediascannerd --startup-scan --db-path=/run/user/%U/usrshr/lightmediascannerd.db --directory=/media --directory=%h/Music --directory=%h/Videos
+SmackProcessLabel=User::App::agl-service-mediascanner
+ExecStart=/usr/bin/lightmediascannerd --startup-scan --db-path=/run/user/%U/usrshr/lightmediascannerd.db --directory=/media --directory=/home/0/Music --directory=/home/0/Videos
[Install]
-WantedBy=default.target
+WantedBy=multi-user.target
Alias=dbus-org.lightmediascanner.service