-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·67 lines (55 loc) · 1.56 KB
/
install
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
#!/usr/bin/env sh
set -e
log() {
echo "📌 $1"
}
log "Start!!!"
DOTFILES_REPO="https://github.com/taakuuyaa/dotfiles.git"
DOTFILES_PATH="$HOME/dotfiles"
clone_dotfiles() {
if [ ! -d "$DOTFILES_PATH" ]; then
log "Cloning dotfiles repository..."
git clone --recursive "$DOTFILES_REPO" "$DOTFILES_PATH"
else
log "Dotfiles repository already exists. Skipping clone."
fi
}
install_homebrew() {
if ! command -v brew >/dev/null 2>&1; then
log "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH="/opt/homebrew/bin:$PATH"
else
log "Homebrew is already installed."
fi
}
update_homebrew() {
log "Running brew doctor and brew update..."
brew doctor || log "brew doctor encountered an error, but continuing..."
brew update || log "brew update encountered an error, but continuing..."
}
install_brew_bundle() {
if [ -f "$DOTFILES_PATH/Brewfile" ]; then
log "Installing packages from Brewfile..."
brew bundle --file="$DOTFILES_PATH/Brewfile" -v
else
log "Brewfile not found at $DOTFILES_PATH. Skipping Homebrew Bundle."
fi
}
link_dotfiles() {
if command -v rcup >/dev/null 2>&1; then
log "Linking dotfiles with rcm..."
env RCRC="$DOTFILES_PATH/rcrc" rcup
else
log "rcm is not installed. Please install it to link dotfiles."
fi
}
# use with google-japanese-ime
softwareupdate --install-rosetta
clone_dotfiles
install_homebrew
update_homebrew
install_brew_bundle
link_dotfiles
log "End!!!"