# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>

pkgname=moosefs
pkgver=3.0.105
pkgrel=1
pkgdesc='High performing and fault tolerant distributed file system'
url='https://moosefs.com/'
replaces=(mfs-master mfs-chunkserver mfs-client)
conflicts=(mfs-master mfs-chunkserver mfs-client)
arch=(x86_64)
license=(GPL2)
makedepends=(git)
depends=(fuse2 libpcap python2 xfsprogs)
source=("git+https://github.com/moosefs/moosefs#tag=v$pkgver"
        'moosefs.sysusers')
sha256sums=('SKIP'
            'c7fb746f904bf4ecaaa6b15b9bce7a5b3bbe3008247148c561280eba8df250dc')

build() {
  cd moosefs
  ./configure \
    --prefix=/usr \
    --mandir=/usr/share/man \
    --sysconfdir=/etc \
    --localstatedir=/var/lib \
    --with-default-user=mfs \
    --with-default-group=mfs \
    --with-systemdsystemunitdir=/usr/lib/systemd/system
  make
}

package() {
  make DESTDIR="$pkgdir" -C moosefs install

  # Move mount.moosefs from sbin to usr/bin. They end up in
  # /usr/bin just the same, but this silences a warning.
  mv "$pkgdir/sbin/"* "$pkgdir/usr/bin/"
  mv "$pkgdir/usr/sbin/"* "$pkgdir/usr/bin/"
  rmdir "$pkgdir/sbin" "$pkgdir/usr/sbin"

  install -Dm644 "$pkgname.sysusers" "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
}

# getver: moosefs.com/download/sources.html
# vim: ts=2 sw=2 et:
