summaryrefslogtreecommitdiff
path: root/core/dbus-core/dbus.install
blob: 88a568429e9fc37d05fe88141c065a0287308a67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
post_install() {
  getent group dbus >/dev/null || groupadd -g 81 dbus
  getent passwd dbus >/dev/null || useradd -c 'System message bus' -u 81 -g dbus -d '/' -s /bin/false dbus
  passwd -l dbus &>/dev/null

  if [[ ! -L var/lib/dbus/machine-id ]]; then
    [[ -e var/lib/dbus/machine-id && ! -e etc/machine-id ]] && mv var/lib/dbus/machine-id etc/
    ln -sf ../../../etc/machine-id var/lib/dbus/
  fi
  dbus-uuidgen --ensure=etc/machine-id
}

post_upgrade() {
  post_install

  # Make sure new rc script can shutdown running dbus
  if [ -f run/dbus.pid -a -d run/dbus ]; then
    mv run/dbus.pid run/dbus/pid
  fi
}

post_remove() {
  if getent passwd dbus >/dev/null; then
    userdel dbus
  fi
  if getent group dbus >/dev/null; then
    groupdel dbus
  fi
}