# Maintainer: Daniel Langbein <daniel@systemli.org>
_pkgname=locale
_reponame=arch
pkgname="de-p1st-$_pkgname"
pkgver=0.0.10
pkgrel=1
pkgdesc="locale and timezone"
arch=('any')
url="https://codeberg.org/privacy1st/${_reponame}"
license=('MIT')
depends=('holo')
makedepends=('git')
backup=('etc/locale.conf' 'etc/localtime')
install='.install'
source=("git+${url}.git")
sha256sums=('SKIP')

package() {
  cd "${_reponame}/pkg/${pkgname}"

  # Note: The following three files are overwritten with "holo apply --force ..."
  # See ".install" script

  # Copy locale.conf to /etc/locale.conf so that one package owns that file
  # in this PKGBUILD, add /etc/locale.conf to backup array so that pacman does not fail if this file already exists on the filesystem
  # (a ".pacnew" file will be created in that case)
  # and then use holo with "--force" to overwrite the local version with the desired one
  install -Dm0644 locale.conf              "$pkgdir"/etc/locale.conf
  install -Dm0644 locale.conf              "$pkgdir"/usr/share/holo/files/"$pkgname"/etc/locale.conf
  #
  ln -sf /usr/share/zoneinfo/Europe/Berlin "$pkgdir"/etc/localtime
  ln -sf /usr/share/zoneinfo/Europe/Berlin "$pkgdir"/usr/share/holo/files/"$pkgname"/etc/localtime

  install -Dm0644 locale.gen               "$pkgdir"/usr/share/holo/files/"$pkgname"/etc/locale.gen
}