From 6efca1addcddec3edd45f03f774586711cb3b54c Mon Sep 17 00:00:00 2001 From: Степанов Алексей Сергеевич Date: Fri, 14 Feb 2025 10:16:52 +0000 Subject: update clone-dotfiles.sh --- clone-dotfiles.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ cloneDotfiles.sh | 46 ---------------------------------------------- 2 files changed, 46 insertions(+), 46 deletions(-) create mode 100755 clone-dotfiles.sh delete mode 100755 cloneDotfiles.sh diff --git a/clone-dotfiles.sh b/clone-dotfiles.sh new file mode 100755 index 0000000..cbc43f3 --- /dev/null +++ b/clone-dotfiles.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +declare -g httpsToken + +export +function setStatusE() { + if [[ "$1" = "on" ]]; then + set -e + else + set +e + fi +} + +setStatusE "on" + +function getKdbxFile() { + read -r passwordFileLink < <("$HOME/.local/bin/yadisk-direct" https://yadi.sk/d/o4TMFnHFobxTsw) + + wget "$passwordFileLink" -O ~/Passwords.kdbx +} + +function openKeepass() { + setStatusE "off" + + httpsToken=$(keepassxc-cli show --attribute https-token "$HOME/Passwords.kdbx" soft-serve 0) + return 0 +} + +pipx install wldhx.yadisk-direct + +if [[ "$?" -eq 1 ]]; then + echo "Ошибка установки wldhx.yadisk-direct... Выход" + exit 1 +fi + +getKdbxFile + +while :; do + if [[ $(openKeepass) -eq 0 ]]; then + setStatusE "on" + break + fi +done + +cd +git clone https://"$httpsToken"@ss.bluig.xyz/.init.git "$HOME/init" diff --git a/cloneDotfiles.sh b/cloneDotfiles.sh deleted file mode 100755 index fcccb33..0000000 --- a/cloneDotfiles.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -function setStatusE() { - if [[ "$1" = true ]]; then - set +e - else - set -e - fi -} - -setStatusE false - -function getKdbxFile() { - read -r passwordFileLink < <("$HOME/.local/bin/yadisk-direct" https://yadi.sk/d/o4TMFnHFobxTsw) - - wget "$passwordFileLink" -O ~/Passwords.kdbx -} - -function openKeepass() { - setStatusE true - - keepassxc-cli clip ~/Passwords.kdbx Github 0 -a token-cli -} - -pipx install wldhx.yadisk-direct - -if [[ "$?" -eq 1 ]]; then - echo "Ошибка установки wldhx.yadisk-direct... Выход" - exit 1 -fi - -getKdbxFile - -while :; do - openKeepass - - if [[ $? -eq 0 ]]; then - setStatusE false - echo -e "Пароль скопирован!\n" - break - fi -done - -cd -git clone https://blueingreen68@github.com/blueingreen68/dotfiles "$HOME"/.dotfiles -wl-copy -c -- cgit