-
Notifications
You must be signed in to change notification settings - Fork 0
/
.init
executable file
·67 lines (53 loc) · 1.29 KB
/
.init
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
#!/usr/bin/env bash
# TODO help/status/usage messages etc
# TODO log / fail fn like mmk?
# TODO xcode tools
# TODO actually move dotfiles and git repo
# TODO this should be in repo root. check on startup and fail if not?
set -e
exists () {
type $1 2> /dev/null
}
prompt () {
while true; do
echo
read -p "$@ (yes/no) " answer
case $answer in
yes) return 0;;
no) return 1;;
*) echo "Please answer yes or no.";;
esac
done
}
copyToHome () {
local item="$1"
local gb="\e[1;34m"
local ge="\e[0m"
if test -e ~/$item; then
if prompt "$gb~/${item}$ge already exists; would you like to overwrite it?"; then
echo YES
else
echo NO
fi
else
echo "Copying \"${item}\" to ~/${item}"
cp $item ~/$item
fi
}
if test $(uname -s) == 'Darwin'; then
if ! exists brew 1> /dev/null; then
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
## TODO check for existence first
#brew install autojump fish node python vim haskell-stack # git
## TODO check for existence first
#npm install --global spot
#if ! grep fish /etc/shells; then
# sudo bash -c "echo /usr/local/bin/fish >> /etc/shells"
# chsh -s /usr/local/bin/fish
#fi
for item in *; do
copyToHome $item
done
fi
echo done