post_install() {
  # Enable service by default, creating an alias from
  # pipewire-session-manager.service, which is required by pipewire.service
  systemctl --global enable wireplumber.service
}

post_upgrade() {
  # Reenable the service if needed so the alias gets created.
  if (( $(vercmp "$2" '0.4.4-2') < 0)); then
    # Unlike pipewire-media-session, we introduce the enable of wireplumber
    # in the same release as the alias, thus can unconditionally reenable.
    systemctl --global reenable wireplumber.service
    cat <<MSG
>>> If you enabled wireplumber.service manually for any user, run
    "systemctl --user reenable wireplumber.service" for these users
    now. This will create a required service alias.
MSG
  fi
}

pre_remove() {
  systemctl --global disable wireplumber.service
}
