--wip-- [skip ci]

This commit is contained in:
2024-08-25 11:07:07 +05:00
parent fb4146c419
commit 92c8fc3302
3 changed files with 61 additions and 1 deletions

10
README.md Normal file
View File

@@ -0,0 +1,10 @@
# Запустить удалённый скрипт:
## wget
```
wget -qO - https://g.torshes.ru/alex/galias-d/raw/branch/main/galias-d.sh | bash
```
## curl
```
source <(curl -s https://g.torshes.ru/alex/galias-d/raw/branch/main/galias-d.sh)
```

51
galias-d.sh Normal file
View File

@@ -0,0 +1,51 @@
#!/bin/bash
# set -x
echo "hey! this is talias-d!"
check_apt() {
sudo apt install git -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
# Попробовать склонировать репозиторий
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

1
hw.md
View File

@@ -1 +0,0 @@
hello world