-
Notifications
You must be signed in to change notification settings - Fork 0
/
go
40 lines (29 loc) · 810 Bytes
/
go
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
#!/bin/bash -e
os="$(uname)"
saveas=.dotfiles
if ! command -v git > /dev/null 2>&1; then
echo >&2 "error: git not found!"
exit 1
fi
if [[ $os == Darwin || $os == Linux ]]; then
cd ~
if [[ -e $saveas ]]; then
echo >&2 "error: $saveas directory already exists!"
exit 1
fi
if [[ $os == Darwin ]] && [[ $(uname -m) == arm64 ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
git clone https://github.com/mfinelli/dotfiles.git $saveas
cd $saveas
./run.bash
remote="$(git remote -v | grep origin | grep fetch | awk '{print $2}')"
# switch to ssh remote now we have our ssh keys
if grep -q '^https' <<< "$remote"; then
git remote set-url origin [email protected]:mfinelli/dotfiles.git
fi
else
echo >&2 "error: unsupported operating system!"
exit 1
fi
exit 0