#!/bin/sh

# Try not to trap a user running this script!
TMP="${AUTOPKGTEST_TMP:-/tmp}"
HOME="$TMP/propellor-autopkgtest-init"

set -e

mkdir -p "$HOME"

# Since cabal-install version 3.12, it needs a package list.
# https://github.com/haskell/cabal/blob/master/release-notes/cabal-install-3.12.1.0.md
# > Die if package list is missing #8944
# > If a package list is missing, cabal will now die and suggest the user to
# > run cabal update instead of continuing into not being able to find
# > packages coming from the remote package server
cabal update

# Choose the full repo init.
echo A | propellor --init

# Initial configuration should build.
if [ -x "$HOME/.propellor/propellor" ]; then
	echo "success"
else
	echo "no propellor build"
	exit 1
fi
