From af1c6967f09a51c600742de6e299255ff07b4a47 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Mon, 22 Jul 2019 23:26:40 +0300 Subject: 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 --- ...m-G_BUS_TYPE_SESSION-to-G_BUS_TYPE_SYSTEM.patch | 49 ++++++++++++++++++++++ .../files/dbus-lightmediascanner.conf | 7 +++- .../files/lightmediascanner.service | 5 ++- 3 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 meta-agl-profile-core/recipes-multimedia/lightmediascanner/files/0002-switch-from-G_BUS_TYPE_SESSION-to-G_BUS_TYPE_SYSTEM.patch (limited to 'meta-agl-profile-core/recipes-multimedia/lightmediascanner/files') 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 +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 +--- + 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 @@ - + + + + + + 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 -- cgit 1.2.3-korg