-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·58 lines (46 loc) · 1.34 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
#!//bin/bash
set -eu
readonly ARCH_TYPE="$(arch)"
readonly DOTPATH="${HOME}/share/dotfiles"
echo -e "\nInstallation has started...\n"
echo -e "My architecture: ${ARCH_TYPE}\n"
# Install Rosetta 2 for Apple silicon
if [ "${ARCH_TYPE}" = "arm64" ]; then
softwareupdate --install-rosetta --agree-to-license
echo
fi
# Install Homebrew
if ! command -v brew >/dev/null 2>&1; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo
fi
# Export brew path to Homebrew Bundle
if [ "${ARCH_TYPE}" = "i386" ]; then
export PATH="/usr/local/bin:${PATH}" # for Intel
elif [ "${ARCH_TYPE}" = "arm64" ]; then
export PATH="/opt/homebrew/bin:${PATH}" # for Apple silicon
fi
# Clone repository
if [ ! -d "${DOTPATH}" ]; then
git clone https://github.com/takyshu98/dotfiles.git "${DOTPATH}"
else
echo "Already downloaded: ${DOTPATH}"
echo "Stash local changes and updating..."
git -C "${DOTPATH}" stash
git -C "${DOTPATH}" switch master
git -C "${DOTPATH}" pull origin master
echo
fi
# Install command line tools and applications
brew bundle --file "${DOTPATH}/Brewfile"
echo
# Make symbolic links and directories
"${DOTPATH}/scripts/symlink.sh"
echo
# Restore macOS settings
"${DOTPATH}/scripts/defaults.sh"
echo
# Restore application settings
mackup -v restore
echo
echo "Installation completed!"