# Maintainer: Markus Pesch <markus.pesch@cryptic.systems>

pkgname=cs-dev-sshkeys
pkgver=0.2.0
pkgrel=0
pkgdesc='Register development ssh keys in /root/.ssh/authorized_keys'
arch=('x86_64' 'armv7h')
url=https://git.cryptic.systems/volker.raschek/set-sshkeys
license=('Apache 2.0')
depends=('openssh')
install=${pkgname}.install
makedepends=('git' 'go' 'make')
source=(
  "https://git.cryptic.systems/volker.raschek/set-sshkeys/archive/v${pkgver}.tar.gz"
  "local://authorized_keys"
)
sha512sums=(
  "20f237a92d40ae0324ec5e6c4226965148ef8aef3c2cd41279d2278f93353b3f93d6e8cf1cc4fe9b9abe6dc7d9588e60d0a6a983bd7c6ff9ede000925b91479f"
  "SKIP"
)

build() {
  GOBIN=${HOME}/go/bin
  PATH=${GOBIN}:${PATH}
  make --directory ${srcdir}/set-sshkeys bin/tmp/set-sshkeys VERSION=${pkgver}
}

package() {
  install -D --mode 644  ${srcdir}/authorized_keys ${pkgdir}/etc/set-sshkeys/authorized_keys
  install -D --mode 4755 ${srcdir}/set-sshkeys/bin/tmp/set-sshkeys ${pkgdir}/usr/bin/set-sshkeys
  install -D --mode 644  ${srcdir}/set-sshkeys/LICENSE ${pkgdir}/usr/share/licenses/set-sshkeys/LICENSE
}