# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Sébastien Luttringer <seblu@aur.archlinux.org>

pkgname=lynis
pkgver=3.0.5
pkgrel=1
pkgdesc='Security and system auditing tool to harden Unix/Linux systems'
url='https://cisofy.com/lynis/'
arch=('any')
license=('GPL3')
backup=('etc/lynis/default.prf')
depends=('sh' 'awk')
optdepends=('net-tools: networking tests'
            'bind-tools: nameserver tests'
            'iptables: firewall tests'
            'bash-completion: completion for bash')
source=(https://downloads.cisofy.com/lynis/lynis-${pkgver}.tar.gz{,.asc})
sha512sums=('bd95ebc6f33f0f94937b2ba92296a82b15626102c8112dc5c71118cad1af32a5e4df83695ba15ecda19e51563836cc1f8ad8078ef855ad21d11672baa773d789'
            'SKIP')
validpgpkeys=('73AC9FC55848E977024D1A61429A566FD5B79251') # CISOfy (Software Signing Key) <security@cisofy.com>

prepare() {
  cd ${pkgname}
  sed -e 's|/path/to/lynis|/usr/bin/lynis|g' -i extras/systemd/lynis.service
}

package() {
  cd ${pkgname}

  # application
  install -Dm 755 lynis -t "${pkgdir}/usr/bin"
  install -Dm 644 default.prf -t "${pkgdir}/etc/${pkgname}"
  install -d "${pkgdir}/usr/share/${pkgname}"
  cp -ra db include plugins "${pkgdir}/usr/share/${pkgname}"

  # doc files
  install -Dm 644 README INSTALL CHANGELOG.md FAQ \
    -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 "${pkgname}.8" -t "${pkgdir}/usr/share/man/man8"

  # completion
  install -Dm 644 extras/bash_completion.d/${pkgname} \
    -t "${pkgdir}/usr/share/bash-completion/completions"

  # systemd
  install -Dm 644 extras/systemd/{lynis.service,lynis.timer} \
    -t "${pkgdir}/usr/lib/systemd/system"
}

# vim: ts=2 sw=2 et:
