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

pkgname=hdparm
pkgver=9.65
pkgrel=01
pkgdesc="A shell utility for manipulating Linux IDE drive/driver parameters"
arch=(x86_64)
depends=('glibc')
source=(https://downloads.sourceforge.net/sourceforge/hdparm/${pkgname}-${pkgver}.tar.gz
		pass-ldflags.patch)
url="https://sourceforge.net/projects/hdparm/"
options=('emptydirs')

prepare() {
  cd ${pkgname}-${pkgver}
#  # Fix Range input/output error when wiping Intel G2 and OCZ drives
#  patch -Np1 -i "$srcdir"/wiper.sh.2_6.max-ranges.patch
  # Enable FULL RELRO
  patch -Np1 -i "$srcdir"/pass-ldflags.patch
}

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

package() {
  cd ${pkgname}-${pkgver}
  # install
  mkdir -p "${pkgdir}"/usr/bin
  make DESTDIR="${pkgdir}" sbindir=/usr/bin install
  install -m755 contrib/idectl "${pkgdir}"/usr/bin
  install -m755 contrib/ultrabayd "${pkgdir}"/usr/bin

  install -D -m 0644 $srcdir/$pkgname-$pkgver/wiper/README.txt "$pkgdir"/usr/share/doc/wiper/README.txt
  install -D -m 0755 $srcdir/$pkgname-$pkgver/wiper/wiper.sh "$pkgdir"/usr/bin/wiper.sh

  #install license file
  install -D -m 644 LICENSE.TXT "$pkgdir"/usr/share/licenses/hdparm/LICENSE.TXT
}

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

license=('BSD')

sha256sums=(d14929f910d060932e717e9382425d47c2e7144235a53713d55a94f7de535a4b # hdparm-9.65.tar.gz
	77ffdda10ff4006d873ef71f00e562992e1f256d3d6d14bfcc10c57d7e4449c1) # pass-ldflags.patch


