-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
53 lines (47 loc) · 1.63 KB
/
setup.sh
File metadata and controls
53 lines (47 loc) · 1.63 KB
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
#!/bin/sh
which brew >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "[INFO] homebrew is not installed."
echo "[INFO] installing homebrew."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "[INFO] updating homebrew."
brew update
else
echo "[INFO] homebrew is already installed."
fi
which ansible >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "[INFO] installing ansible."
brew install ansible
else
echo "[INFO] ansible is already installed."
fi
echo "[INFO] Installing ansible collections."
ansible-galaxy collection install community.general
### Execute ansible
echo "[INFO] Executing ansible."
ansible-playbook -vv -i ansible/hosts ansible/playbook.yml -K
### Prepare .dotfiles
echo "[INFO] Preparing dotfiles."
if [ -d ~/.dotfiles ]; then
echo "[INFO] .dotfiles already exists."
else
echo "[INFO] Creating .dotfiles"
git clone https://github.com/hidapple/dotfiles.git ~/.dotfiles
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
sh ~/.dotfiles/link.sh
source ~/.config/fish/config.fish
fi
### Create .gitconfig.local
echo "[INFO] Create .gitconfig.local."
if [ -f $XDG_CONFIG_HOME/git/config.local ]; then
echo "[INFO] git local config file already exists."
else
echo "name: \c" && read name
echo "email: \c" && read email
echo "[user]" > $XDG_CONFIG_HOME/git/config.local
echo " name = $name" >> $XDG_CONFIG_HOME/git/config.local
echo " email = $email" >> $XDG_CONFIG_HOME/git/config.local
echo "[INFO] Created git local config file."
fi