Files
gotelegram_pro/bootstrap.sh
2026-04-06 22:30:06 +03:00

64 lines
2.4 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# GoTelegram v2.2.1 — Bootstrap installer (private repo)
set -euo pipefail
TOKEN="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"
REPO="anten-ka/gotelegram_pro"
BRANCH="test"
API="https://api.github.com/repos/$REPO"
INSTALL_DIR="/opt/gotelegram"
echo -e "\033[1;36m"
echo "╔══════════════════════════════════════════╗"
echo "║ GoTelegram v2.2.1 — Установка ║"
echo "╚══════════════════════════════════════════╝"
echo -e "\033[0m"
# Функция загрузки файла из приватного репо
dl() {
local path="$1" dest="$2"
mkdir -p "$(dirname "$dest")"
curl -sfL -H "Authorization: token $TOKEN" \
-H "Accept: application/vnd.github.v3.raw" \
"$API/contents/$path?ref=$BRANCH" -o "$dest"
sed -i 's/\r$//' "$dest"
echo "$path"
}
echo "📦 Скачиваю файлы..."
mkdir -p "$INSTALL_DIR/lib" "$INSTALL_DIR/gotelegram-bot"
# Основные файлы
dl "install.sh" "$INSTALL_DIR/install.sh"
dl "install_gotelegram_bot.sh" "$INSTALL_DIR/install_gotelegram_bot.sh"
dl "templates_catalog.json" "$INSTALL_DIR/templates_catalog.json"
# Библиотеки
dl "lib/common.sh" "$INSTALL_DIR/lib/common.sh"
dl "lib/telemt.sh" "$INSTALL_DIR/lib/telemt.sh"
dl "lib/telemt_config.sh" "$INSTALL_DIR/lib/telemt_config.sh"
dl "lib/backup.sh" "$INSTALL_DIR/lib/backup.sh"
dl "lib/website.sh" "$INSTALL_DIR/lib/website.sh"
dl "lib/templates_catalog.sh" "$INSTALL_DIR/lib/templates_catalog.sh"
# Бот
dl "gotelegram-bot/bot.py" "$INSTALL_DIR/gotelegram-bot/bot.py"
dl "gotelegram-bot/config.example.env" "$INSTALL_DIR/gotelegram-bot/config.example.env"
dl "gotelegram-bot/requirements.txt" "$INSTALL_DIR/gotelegram-bot/requirements.txt"
dl "gotelegram-bot/README.md" "$INSTALL_DIR/gotelegram-bot/README.md"
# Права
chmod +x "$INSTALL_DIR/install.sh" "$INSTALL_DIR/install_gotelegram_bot.sh"
# Команда gotelegram
ln -sf "$INSTALL_DIR/install.sh" /usr/local/bin/gotelegram
chmod +x /usr/local/bin/gotelegram
echo ""
echo -e "\033[1;32m✅ Все 13 файлов скачаны в $INSTALL_DIR\033[0m"
echo -e "\033[1;33m💡 Команда для запуска меню: gotelegram\033[0m"
echo ""
# Запускаем меню
exec bash "$INSTALL_DIR/install.sh"