-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall
executable file
·38 lines (33 loc) · 994 Bytes
/
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
#!/usr/bin/env zsh
PATH=$PATH:/opt/homebrew/bin:$HOME/.local/bin
set -e # -e: exit on error
while [[ "$#" -gt 0 ]]; do
case $1 in
-s|--skip) skip_install=1 ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done
if [ ! "$(command -v brew)" ]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
if [ ! "$(command -v chezmoi)" ]; then
bin_dir="$HOME/.local/bin"
chezmoi="$bin_dir/chezmoi"
if [ "$(command -v curl)" ]; then
sh -c "$(curl -fsSL https://git.io/chezmoi)" -- -b "$bin_dir"
elif [ "$(command -v wget)" ]; then
sh -c "$(wget -qO- https://git.io/chezmoi)" -- -b "$bin_dir"
else
echo "To install chezmoi, you must have curl or wget installed." >&2
exit 1
fi
else
chezmoi=chezmoi
fi
if [ "$skip_install" == "1" ]; then
echo "Skipping install..."
chezmoi init https://github.com/mtxr/dotfiles.git
else
chezmoi init --apply https://github.com/mtxr/dotfiles.git
fi