-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·72 lines (58 loc) · 1.56 KB
/
install.sh
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env bash
set -euo pipefail
readonly RED='\033[0;31m'
readonly GREEN='\033[0;32m'
readonly CYAN='\033[0;36m'
readonly BCYAN='\033[1;36m'
readonly NC='\033[0m'
BW_SESSION=${BW_SESSION:-""}
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=linux;;
Darwin*) machine=darwin;;
CYGWIN*) machine=cygwin;;
MINGW*) machine=mingw;;
*) machine="UNKNOWN:${unameOut}"
esac
log() {
local statement="$1"
echo -e "${CYAN}==> $statement${NC}"
}
announce() {
local statement="$1"
echo -e "${BCYAN}==>${NC}${GREEN} $statement${NC}"
}
isavailable() {
type "$1" &> /dev/null
}
main() {
# ===============================
# Install
# ===============================
if [ $machine == "linux" ]; then
sudo apt-get -y install zsh build-essential
sudo chsh -s $(which zsh) $(whoami)
fi
# ===============================
# Homebrew
# ===============================
if ! isavailable brew; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
log "Follow directions above and then re-run the curl install.sh command"
exit 0
else
log "Homebrew already installed"
fi
if ! isavailable jq; then
# ===============================
# Install minimal requirement
# ===============================
brew install gcc git vim chezmoi bitwarden-cli gnupg jq
fi
# ===============================
# Initialize dotfiles
# ===============================
ASK=1 MINIMAL=1 chezmoi init mdespuits/dotfiles -S ~/.dotfiles
}
main
# vim: ft=sh