From 8e9b0d542e7808fd06ffe908a27c8f0bf86220db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9=D0=BA=D0=B0?= Date: Fri, 20 Feb 2026 21:09:55 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A6=D0=B2=D0=B5=D1=82=D0=BD=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- galias-d.sh | 69 ++++++++++++++++++++--------------------------------- 1 file changed, 26 insertions(+), 43 deletions(-) diff --git a/galias-d.sh b/galias-d.sh index 578c455..9516580 100644 --- a/galias-d.sh +++ b/galias-d.sh @@ -1,51 +1,34 @@ #!/bin/bash -# set -x +set -x -echo "hey! this is talias-d!" +# Цвета для вывода +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# Форматирование текста +function msgerr() +{ + echo -e "${RED}$1${NC}" +} +function msgok() +{ + echo -e "${GREEN}$1${NC}" +} +function msgpr() +{ + echo -e "\e[35m$1${NC}" +} + +msgpr "hey! this is talias-d!" + +msgerr "hey! this is ERROR!" +msgok "hey! this is OK!" check_apt() { sudo apt install $1 -y } -read_ssh_pub_key() { - local ssh_dir="$HOME/.ssh" - local pub_key - - if [ ! -d "$ssh_dir" ]; then - echo "Директория не существует" >&2 - return 1 - fi - - pub_key=$(find "$ssh_dir" -maxdepth 1 -name "*.pub" -type f | head -n 1) - - echo " Ключ для копирования в gitea https://g.torshes.ru/user/settings/keys" - - # если pub_key не пустой и является файлом - if [ -n "$pub_key" ] && [ -f "$pub_key" ]; then - cat "$pub_key" - return 0 - else - echo "Публичные SSH-ключи не найдены в $ssh_dir" >&2 - return 1 - fi -} - -# Показать ключ или создать его -if read_ssh_pub_key; then - echo "Ключ успешно прочитан" -else - local ALGORITHM="ed25519" - ssh-keygen -t $ALGORITHM -f ~/.ssh/id_$ALGORITHM -N "" > /dev/null - read_ssh_pub_key -fi - -check_apt git -# Попробовать склонировать репозиторий -TALIAS_DIR="$HOME/.talias" -if [ $(git clone ssh://git@g.torshes.ru:57322/alex/talias.git $TALIAS_DIR) ]; then - echo ERROR - return 1 -fi - -cat $TALIAS_DIR/README.md