aboutsummaryrefslogtreecommitdiff
path: root/clone-dotfiles.sh
blob: cbc43f3db1305a2c902b645a6587fb192fa03f73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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"