--- /dev/null
+# if DBUS session address is not set, try to set it, by getting the DBUS_SESSIONS_BUS_ADDRESS variable
+# from the first systemd process running for the current user.
+# This typically allows a 'su - <user>' command to have the right DBUS address.
+
+if [[ -z "$DBUS_SESSION_BUS_ADDRESS" ]]; then
+ systemd_pid=$(pgrep -U $UID systemd | head -1)
+ if [[ -n "$systemd_pid" ]]; then
+ val=$(sed '/\<DBUS_SESSION_BUS_ADDRESS=/!d ; s/.*\<DBUS_SESSION_BUS_ADDRESS=\([^[:cntrl:]]*\).*/\1/' /proc/${systemd_pid}/environ)
+ [[ -n "$val" ]] && export DBUS_SESSION_BUS_ADDRESS=$val
+ fi
+fi
+
Source4: baselibs.conf
Source5: dbus-user.service
Source6: dbus-user.socket
+Source7: dbus.sh
BuildRequires: libcap-ng-devel
BuildRequires: pkgconfig(libsmack)
# COMMON1-END
rm -rf %{buildroot}/%{_mandir}/man1/dbus-launch.1*
rm -rf %{buildroot}/%{_bindir}/dbus-launch
+# install script for login shells (/etc/profile.d)
+install -d %{buildroot}%{_sysconfdir}/profile.d
+install -m0644 %{SOURCE7} %{buildroot}%{_sysconfdir}/profile.d/dbus.sh
%pre
# Add the "dbus" user and group
%dir %{_localstatedir}/lib/dbus
%dir /lib/dbus-1
%dir /lib/dbus-1/system-services
-%license COPYING
+%license COPYING
%config(noreplace) %{_sysconfdir}/dbus-1/session.conf
%config(noreplace) %{_sysconfdir}/dbus-1/system.conf
%{_sysconfdir}/ConsoleKit
%dir %{_datadir}/dbus-1/interfaces
%dir %{_datadir}/dbus-1/services
%dir %{_datadir}/dbus-1/system-services
+%{_sysconfdir}/profile.d/dbus.sh
%files devel-doc
%defattr(-,root,root)