#!/bin/sh

REPO_CONF_DIR="{$PWD}"
REPO_CONF_NAME="pkg.conf"

# Проверка и установка git в FreeBSD
if ! command -v git >/dev/null 2>&1; then
    cat > pkg.conf << EOF
    xserver_dep_repo: {
    	url: "file://${PWD}/packages",
    	enabled: yes,
    	priority: 100
    }
EOF

    pkg -o REPOS_DIR="$REPO_CONF_DIR"  -o repositories_conf="$REPO_CONF_NAME" install -y git || { echo "Ошибка установки git"; exit 1; }
fi

cp ./ccomp /usr/local/bin/ccomp
cp ./gproxy /usr/local/bin/gproxy

mkdir /calista/config/ccomp
mkdir /calista/cache/gproxy
mkdir /calista/config/gproxy

pkg register -M ccomp.pkg
pkg register -M gproxy.pkg
