-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
77 lines (62 loc) · 1.53 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
73
74
75
76
77
#!/usr/bin/env bash
# ===
# Variables
# ===
GHQ_ROOT_DEFAULT="${HOME}/Projects/src"
GHQ_ROOT_CONFIG="$(git config --get ghq.root)"
GHQ_ROOT="${GHQ_ROOT:-"${GHQ_ROOT_CONFIG}"}"
GHQ_ROOT="${GHQ_ROOT:-"${GHQ_ROOT_DEFAULT}"}"
GHQ_ROOT="${GHQ_ROOT/#\~/$HOME}"
DOTFILES_DIR="${GHQ_ROOT}/github.com/muniere/dotfiles"
DOTFILES_URL="https://github.com/muniere/dotfiles.git"
# ===
# Functions
# ===
function clone-repo() {
if ! [ -d "${DOTFILES_DIR}" ]; then
git clone "${DOTFILES_URL}" "${DOTFILES_DIR}"
fi
}
function bundle-core() {
case "$OSTYPE" in
darwin*)
# https://brew.sh
if ! (which brew &> /dev/null); then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# for intel chip
if [ -x /usr/local/bin/brew ]; then
eval "$(/usr/local/bin/brew shellenv)"
fi
# for apple chip
if [ -x /opt/homebrew/bin/brew ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
fi
# https://github.com/Homebrew/homebrew-bundle
brew bundle install --no-lock --file vault/brew/core/Brewfile
;;
*) ;;
esac
}
function bundle-more() {
case "$OSTYPE" in
darwin*)
# https://github.com/Homebrew/homebrew-bundle
brew bundle install --no-lock --file vault/brew/more/Brewfile
;;
*) ;;
esac
}
function link-files() {
cd "${DOTFILES_DIR}"
deno task link
cd -
}
# ===
# Main
# ===
set -eux
clone-repo
bundle-core
link-files
bundle-more