#! /bin/sh

# Quality of Life utilities:
qol='
	nvi
	nano
	less
	procps
	strace
	wget
	curl
	unzip
'

# Required for building Debian packages (tools/make-dist):
building='
	ca-certificates
	git
	build-essential
	devscripts
'

# Services necessary for hosting the application inside Docker:
hosting='
	postgresql
	apache2
	libapache2-mod-wsgi-py3
'

# Build-Depends from debian/control:
build_depends='
	debhelper
	dh-python
	python3-setuptools
	apache2-dev
'

# For running the Django unit tests:
test_depends='
'

# Depends from debian/control
depends='
	python3-asgiref
	python3-psycopg2
	python3-django
	python3-django-crispy-forms
	python3-django-filters
	python3-django-tables2
	python3-djangorestframework
	python3-djangorestframework-extensions
  python3-sqlparse
'

# Packages to bootstrap and test Vue:
vue='
	chromium-driver
'

set -ex

export UCF_FORCE_CONFFOLD=1 DEBIAN_FRONTEND=noninteractive

# Always update: due to docker caching there can be a lot of time between
# the RUN statements in Dockerfile!
apt-get update

apt-get -o Dpkg::Options::=--force-confold -y install apt-utils eatmydata
eatmydata apt-get -o Dpkg::Options::=--force-confold -y upgrade

adduser --gecos PostgreSQL          --home /var/lib/postgresql  --uid 499     --system --group --no-create-home  postgres
adduser --gecos "Eloquent"  --home /nonexistent         --uid 500     --system --group --no-create-home  eloquent
adduser --gecos Developer           --home /home/dash           --uid 1000    --disabled-password                dash

eatmydata apt-get -o Dpkg::Options::=--force-confold -y install $qol $building $hosting $build_depends $test_depends $depends $vue

apt-get clean
