#!/bin/bash

put() {
    echo "$1" >> "$HOME/.bashrc"
}

mark="# added by https://gitea.vornet.cz/netvor/mydots"
if grep -qFe "$mark" "$HOME/.bashrc";
then
    echo "already set up, giving up";
    exit 1;
else
    put ''
    put '# added by https://gitea.vornet.cz/netvor/mydots'
    put 'test -f "${HOME}/.bash/head.bashrc" \'
    put ' && . "${HOME}/.bash/head.bashrc"'
fi