From 84bc15090abdfec47e4e250e2fec6a922a23bb4b Mon Sep 17 00:00:00 2001 From: anten-ka Date: Mon, 6 Apr 2026 21:53:10 +0300 Subject: [PATCH] Add bootstrap.sh for private repo installation --- bootstrap.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 bootstrap.sh diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100644 index 0000000..5919137 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,58 @@ +#!/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" + +echo "" +echo -e "\033[1;32m✅ Все 13 файлов скачаны в $INSTALL_DIR\033[0m" +echo "" + +# Запускаем меню +exec bash "$INSTALL_DIR/install.sh"