#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgbase=os-prober-patched
pkgname=os-prober
pkgver=1.81
pkgrel=01
pkgdesc="Utility to detect other OSes on a set of drives)"
url='https://joeyh.name/code/os-prober/'
#url="http://joey.kitenet.net/code/os-prober/"
arch=('x86_64')
provides=('os-prober' 'os-prober-garuda')
conflicts=('os-prober-btrfs' 'os-prober-garuda')
replaces=('os-prober-garuda')
source=(http://http.debian.net/debian/pool/main/o/${pkgname}/${pkgname}_${pkgver}.tar.xz)

prepare() {
  cd ${pkgname}-${pkgver}

  # adjust lib dir to allow detection of 64-bit distros
  sed -i -e "s:/lib/ld\*\.so\*:/lib*/ld*.so*:g" os-probes/mounted/common/90linux-distro
  rm -f Makefile
}

build() {
  cd ${pkgname}-${pkgver}
  make newns
}

package() {
  cd ${pkgname}-${pkgver}
  depends=(sh which)
  install -Dm 755 os-prober linux-boot-prober -t "${pkgdir}/usr/bin"
  install -Dm 755 newns -t "${pkgdir}/usr/lib/os-prober"
  install -Dm 755 common.sh -t "${pkgdir}/usr/share/os-prober"

  for dir in os-probes os-probes/mounted os-probes/init linux-boot-probes linux-boot-probes/mounted; do
    install -dm 755 "${pkgdir}/usr/lib/${dir}"
    install -m 755 -t "${pkgdir}/usr/lib/${dir}" "${dir}"/common/*
    [[ -d "${dir}"/x86 ]] && cp -r "${dir}"/x86/* "${pkgdir}/usr/lib/${dir}"
  done

  install -Dm 755 os-probes/mounted/powerpc/20macosx "${pkgdir}"/usr/lib/os-probes/mounted/20macosx
  install -dm 755 "${pkgdir}"/var/lib/os-prober
}

#---- license gpg-key sha256sums ----

license=('GPL3')

sha256sums=(2fd928ec86538227711e2adf49cfd6a1ef74f6bb3555c5dad4e0425ccd978883) # os-prober_1.81.tar.xz

