dbus: fix 64-bit compiler warnings
[platform/upstream/dbus.git] / packaging / dbus.sh
1 # if DBUS session address is not set, try to set it, by getting the DBUS_SESSIONS_BUS_ADDRESS variable
2 # from the first systemd process running for the current user.
3 # This typically allows a 'su - <user>' command to have the right DBUS address.
4
5 # pgrep doesn't work at tizen 4.0. Replace with the following code.
6 # if [[ -z "$DBUS_SESSION_BUS_ADDRESS" ]]; then
7 #    systemd_pid=$(pgrep -U $UID systemd | head -1)
8 #    if [[ -n "$systemd_pid" ]]; then
9 #       val=$(tr '\0' '\n' < /proc/${systemd_pid}/environ | sed  '/^DBUS_SESSION_BUS_ADDRESS=/!d ; s/[^=]*=//')
10 #       [[ -n "$val" ]] && export DBUS_SESSION_BUS_ADDRESS=$val
11 #    fi
12 # fi
13
14
15 # The adbd's privilege has been changed form "System::Privileged" to "User::Shell".
16 # So, pgrep does not work with smack errors when accessing /proc.
17 # If it fails to find DBUS address, the fixed address is used.
18
19 if [[ -z "$DBUS_SESSION_BUS_ADDRESS" ]]; then
20    [[ "$UID" != "0" ]] && export DBUS_SESSION_BUS_ADDRESS="kernel:path=/sys/fs/kdbus/${UID}-user/bus;unix:path=/run/user/${UID}/bus"
21 fi
22