# Maintainer: Jeremy Drake <github@jdrake.com>
pkgname='etc-update'
pkgdesc="CLI to interactively merge .pacnew configuration files"
pkgver=3.0.68
pkgrel=1
arch=('any')
url="https://wiki.gentoo.org/wiki/Handbook:X86/Portage/Tools#etc-update"
msys2_repository_url="https://github.com/gentoo/portage"
msys2_references=(
  "anitya: 191471"
  "archlinux: etc-update"
  "cpe: cpe:/a:gentoo:portage"
  "gentoo: sys-apps/portage"
)
license=('GPL')
depends=('bash' 'diffutils')
optdepends=('dialog: for the menu mode (not automode)')
backup=("etc/etc-update.conf")
source=("https://github.com/gentoo/portage/archive/portage-${pkgver}.tar.gz")
sha256sums=('c032531baca2b5c31cb45c020efb32a8eb061da09559937504ca835456265445')
noextract=("portage-${pkgver}.tar.gz")

prepare() {
  plain "Extracting portage-${pkgver}.tar.gz due to symlink(s) without pre-existing target(s)"
  cd "${srcdir}"
  [[ -d portage-portage-${pkgver} ]] && rm -rf portage-portage-${pkgver}
  tar zxf "${srcdir}/portage-${pkgver}.tar.gz" || true
}

package() {
  install -Dm 0755 -t "${pkgdir}/usr/bin" "portage-portage-${pkgver}/bin/${pkgname}"
  install -Dm 0644 -t "${pkgdir}/etc" "portage-portage-${pkgver}/cnf/${pkgname}.conf"
}
