-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
executable file
·41 lines (35 loc) · 1.09 KB
/
bootstrap.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
#!/usr/bin/env bash
# dotfiles bootstrapper
#
# Installs zsh & git, then clones this repo to ~/.dotfiles. This script is
# intended to be run remotely, via curl:
#
# bash <(curl -s https://raw.githubusercontent.com/liujoey/dotfiles/master/bootstrap.sh)
export DOTFILES=~/.dotfiles
set -e
_msg() { printf "\r\033[2K\033[0;32m[ .. ] %s\033[0m\n" "$*"; }
_uncallable() { ! command -v "$1" >/dev/null; }
if _uncallable zsh || _uncallable git; then
# NOTE Macos has both already
_msg "Installing git and/or zsh"
if [[ -f /etc/arch-release ]]; then
sudo pacman --needed --noconfirm -S git zsh
elif [[ -f /etc/debian_version ]]; then
sudo apt-get update && sudo apt-get install -y git zsh
fi
fi
if [[ ! -d ~/.dotfiles ]]; then
_msg "Deploying dotfiles repository..."
if [[ $USER == joey ]]; then
[email protected]:liujoey/dotfiles.git
else
dfrepo=https://github.com/liujoey/dotfiles.git
fi
git clone --recursive "$dfrepo" "$DOTFILES"
fi
#
_msg
_msg "And done!"
_msg
_msg "Use $DOTFILES/deploy to install your dotfiles, I suggest you begin"
_msg "with 'base/arch' or 'base/macos'."