#!/bin/sh
if [[ -z $HOME ]]; then
    echo "`HOME` environment variable is unset"
    exit 1
fi

tgt_conf_dir="$HOME/.tgt/config"
if [[ ! -d $tgt_conf_dir ]]; then
    mkdir -p $tgt_conf_dir &&\
    install -pm 644 /usr/share/tgt-client/config/*.toml $tgt_conf_dir/
fi
/usr/bin/tgt-bin "$@"
