# Author : Clayton Craft <clayton@igalia.com>

pkgname='steamos-systemreport'
pkgver=0.21
pkgrel=1
pkgdesc='System report collection tool'
arch=('x86_64' 'aarch64')
license=('LGPL2.1')
url='https://gitlab.steamos.cloud/holo/holo'
source=(
  'steamos-systemreport'
  'steamos-systemreport-privileged'
  'com.steampowered.SteamOS.systemreport.policy'
)
sha256sums=('4f8b548d411c9f6d923b75c44415c3b356bcc277ce480fe37620d96f0556cd7a'
            '36cfc19000071ebcdf59f23ab9779b26b00dcbaa1b59b0010b72bca7c3198128'
            'b36473e3b77307450e75c59e248dde34d95b69c6c765a425fc30d9e201e23067')

package() {
  depends=(
    'bash'
    'bluez-deprecated-tools'         # hcitool
    'coreutils'                      # dd
    'rauc'                           # rauc status
    'drm_info'                       # drm_info
    'upower'                         # upower
    'wireplumber'                    # wpctl
    'iputils'                        # ping
    'iproute2'                       # ip
    'iwd'                            # iwctl
    'pciutils'                       # lspci
    'usbutils'                       # lsusb
    'systemd'                        # coredumpctl, journalctl
    'procps-ng'                      # ps
    'util-linux'                     # lsblk, hexdump
    'parted'                         # parted
    'smartmontools'                  # smartctl
    'polkit'
    'zstd'
  )

  if [[ "${CARCH}" == "x86_64" ]]; then
    depends+=(
      'steamos-customizations-jupiter' # steamos-{readonly,dump-info}
      'jupiter-hw-support'             # amd_system_info
    )
  elif [[ "${CARCH}" == "aarch64" ]]; then
    depends+=(
      'steamos-customizations-deckard' # steamos-{readonly,dump-info}
    )
  fi

  install -Dm755 steamos-systemreport -t "$pkgdir"/usr/bin/
  install -Dm755 steamos-systemreport-privileged -t "$pkgdir"/usr/bin/steamos-polkit-helpers
  install -m755 -d "$pkgdir"/usr/share/polkit-1/actions
  install -m644 com.steampowered.SteamOS.systemreport.policy -t "$pkgdir"/usr/share/polkit-1/actions
}
