#!/bin/bash

export XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}
export CHECKBOX_DATA=${CHECKBOX_DATA:-.}
export CHECKBOX_SHARE=${CHECKBOX_SHARE:-.}
export CHECKBOX_OPTIONS=${CHECKBOX_OPTIONS:---whitelist-file=$CHECKBOX_SHARE/data/whitelists/default.whitelist}
export PYTHONPATH=$PYTHONPATH:$CHECKBOX_SHARE

if [ $CHECKBOX_DATA != '.' ]
then
    old_data=$HOME/.checkbox
    if [ -d $old_data ] && [ ! -d $CHECKBOX_DATA ]
    then
        mv -f $old_data $CHECKBOX_DATA
    fi
fi

python3 $CHECKBOX_SHARE/run "$@" $CHECKBOX_SHARE/configs/$(basename $0).ini
