Files
2026-07-09 15:56:19 +00:00

57 lines
1.2 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
GITEA_HOST="git.jst.ovh"
GITEA_URL="https://${GITEA_HOST}"
echo "==> Installation des dépendances"
sudo apt update
sudo apt install -y \
git \
curl \
jq \
tar \
build-essential \
golang-go
echo "==> Installation de xcaddy"
export GOPATH="${HOME}/go"
export PATH="${PATH}:${GOPATH}/bin"
if ! command -v xcaddy >/dev/null 2>&1; then
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
fi
if ! grep -q 'HOME/go/bin' "${HOME}/.bashrc"; then
echo 'export PATH="$PATH:$HOME/go/bin"' >> "${HOME}/.bashrc"
fi
echo "==> Installation de tea"
if ! command -v tea >/dev/null 2>&1; then
TMP_TEA="$(mktemp)"
curl -fsSL "https://dl.gitea.com/tea/main/tea-main-linux-amd64" -o "$TMP_TEA"
chmod +x "$TMP_TEA"
sudo mv "$TMP_TEA" /usr/local/bin/tea
fi
echo "==> Vérification de la connexion tea à ${GITEA_HOST}"
if tea login list 2>/dev/null | grep -q "${GITEA_HOST}"; then
echo "Connexion tea existante pour ${GITEA_HOST}"
else
echo "Aucune connexion tea trouvée pour ${GITEA_HOST}"
echo "Création d'une connexion tea..."
tea login add \
--name jst \
--url "${GITEA_URL}"
fi
echo
echo "Versions :"
go version
xcaddy version
tea --version
echo
echo "✅ Init terminé."