-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap
executable file
·52 lines (46 loc) · 1.04 KB
/
bootstrap
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
47
48
49
50
51
52
#!/bin/sh
set -eu
# TODO(ttlgcc): Port to Linux.
# NOTE(ttlgcc): Install bootstrapping tools:
#
# - age
# - chezmoi
# - rbw
#
case "$(uname -s)" in
Darwin)
command -v brew 2>/dev/null || {
export HOMEBREW_NO_ANALYTICS=1
bash -c "$(curl -fsSL https://github.com/Homebrew/install/raw/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv || /usr/local/bin/brew shellenv)"
brew analytics off
}
brew install --quiet age chezmoi rbw
;;
*)
printf 'OS not supported yet\n'
exit 1
;;
esac
# NOTE(ttlgcc): Log in to Bitwarden.
#
printf 'bitwarden email? '
head -n1 | xargs rbw config set email
rbw register
rbw login
# NOTE(ttlgcc): Import secrets.
#
for key in .config/age/dotfiles.key .ssh/id_ed25519 .ssh/id_ed25519.pub
do
mkdir -p ~/$(dirname $key)
rbw get '~'/$key >~/$key
chmod 400 ~/$key
done
ssh-add
# NOTE(ttlgcc): Clone configuration files.
#
chezmoi init --apply tautologicc
chezmoi git config url.'[email protected]:'.insteadOf 'https://github.com/'
# NOTE(ttlgcc): Reboot machine.
#
yesno 'reboot now' && sudo reboot || :