diff options
4 files changed, 69 insertions, 15 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 diff --git a/meta-agl-profile-core/recipes-multimedia/lightmediascanner/lightmediascanner_%.bbappend b/meta-agl-profile-core/recipes-multimedia/lightmediascanner/lightmediascanner_%.bbappend index 7a1dd1a4e..b47b2796c 100644 --- a/meta-agl-profile-core/recipes-multimedia/lightmediascanner/lightmediascanner_%.bbappend +++ b/meta-agl-profile-core/recipes-multimedia/lightmediascanner/lightmediascanner_%.bbappend @@ -5,6 +5,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/files:" SRC_URI += "file://lightmediascanner.service \ file://plugin-ogg-fix-chucksize-issue.patch \ + file://0002-switch-from-G_BUS_TYPE_SESSION-to-G_BUS_TYPE_SYSTEM.patch \ file://dbus-lightmediascanner.conf \ " @@ -12,28 +13,26 @@ CFLAGS_append = " -D_FILE_OFFSET_BITS=64" inherit systemd +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "lightmediascanner.service" +SYSTEMD_AUTO_ENABLE_${PN} = "enable" + do_install_append() { # Install LMS systemd service if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -m 644 -p -D ${WORKDIR}/lightmediascanner.service ${D}${systemd_user_unitdir}/lightmediascanner.service - - # Execute these manually on behalf of systemctl script (from systemd-systemctl-native.bb) - # because it does not support systemd's user mode. - mkdir -p ${D}/etc/systemd/user/default.target.wants/ - ln -sf ${systemd_user_unitdir}/lightmediascanner.service ${D}/etc/systemd/user/dbus-org.lightmediascanner.service - ln -sf ${systemd_user_unitdir}/lightmediascanner.service ${D}/etc/systemd/user/default.target.wants/lightmediascanner.service + install -d ${D}${systemd_system_unitdir} + install -m 644 -p -D ${WORKDIR}/lightmediascanner.service ${D}${systemd_system_unitdir}/lightmediascanner.service fi - install -d ${D}/etc/dbus-1/session.d - install -m 0644 ${WORKDIR}/dbus-lightmediascanner.conf ${D}/etc/dbus-1/session.d/lightmediascanner.conf + install -d ${D}/etc/dbus-1/system.d + install -m 0644 ${WORKDIR}/dbus-lightmediascanner.conf ${D}/etc/dbus-1/system.d/org.lightmediascanner.conf } FILES_${PN} += " \ - ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_user_unitdir}/lightmediascanner.service', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_system_unitdir}/lightmediascanner.service', '', d)} \ " -# for DEMO -EXTRA_OECONF = "--enable-static" +EXTRA_OECONF = "--enable-static --with-dbus-services=${datadir}/dbus-1/system-services" PACKAGECONFIG[mp4] = "--enable-mp4,--disable-mp4,libmp4v2" # add support MP3 because of the format of music files for AGL CES/ALS2017 Demo |