#!/bin/bash


PYTHON=python

if [[ -n "$(which python3 2>&-)" ]]; then
  PYTHON=python3
fi

if [[ $EUID -ne 0 ]]; then
  echo "imgbase must be run as root!"
  exit 1
fi

if [[ -d "src/imgbased" ]]; then
  echo "Enabling in-tree mode ($PYTHON)" >&2
  export PYTHONPATH="$PWD/src"
  export PYTHONDONTWRITEBYTECODE=x
fi

$PYTHON -m imgbased.__main__ $@
