summaryrefslogtreecommitdiff
path: root/install.sh
blob: fe6a370148646cf2be2628e9b7906fa4f4fe08d6 (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
#!/bin/bash

enc_arch="keys"
arch="keys.tar.gz"

function ask() {
    read -p "$1 (Y/n): " resp
    if [ -z "$resp" ]; then
        response_lc="y" # empty is Yes
    else
        response_lc=$(echo "$resp" | tr '[:upper:]' '[:lower:]') # case insensitive
    fi

    [ "$response_lc" = "y" ]
}

for file in ".vimrc" ".tmux.conf" ".bash_profile" ".gitconfig"; do
    if ask "Install ${file}?"; then
      ln -s "$(realpath "$file")" ~/${file}
    fi
done

for file in *; do
  if [ "$file" == "$enc_arch" ]; then
    if ask "Install keys?"; then
      gpg --output "$arch" --decrypt "$enc_arch"
      tar -xzvf "keys.tar.gz" -C ~
      rm -rf keys.tar.gz
    fi
  fi
done