#!/usr/bin/env bash

set -euo pipefail

usage() { echo "Usage: prep-for-debianish-build [pyxattr|xattr]"; }
misuse() { usage 1>&2; exit 2; }

xattr="${1:-pyxattr}"

case "$xattr" in
    pyxattr|xattr) ;;
    *) misuse ;;
esac

# dosfstools: for vfat for the (root) tests
debs=(acl
      attr
      dosfstools
      duplicity
      curl
      e2fsprogs
      gcc
      git
      graphviz
      kmod
      libacl1-dev
      libreadline-dev
      linux-libc-dev
      locales
      make
      man-db
      pandoc
      par2
      pkg-config
      pylint
      python3-"$xattr"
      python3-dev
      python3-fuse
      python3-pytest
      python3-pytest-xdist
      python3-tornado
      rdiff-backup
      rsync)

set -x

export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y "${debs[@]}"
