#!/bin/sh

set -eu

if [ -d $CHARM_DIR/exec.d ]; then
	status-set maintenance 'Invoking charm-pre-install hooks'
	for f in $CHARM_DIR/exec.d/*/charm-pre-install; do
		juju-log "Running $f"
		/bin/sh -c "$f"
	done
fi

juju-log 'Installing packages'
apt-get install -y --no-install-recommends python3-jinja2 python3-yaml

juju-log "Running $CHARM_DIR/hooks/install.py"
exec /usr/bin/python3 $CHARM_DIR/hooks/install.py
