-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·51 lines (38 loc) · 972 Bytes
/
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
#!/bin/sh
# vim: ts=2 sw=2 sts=2 et
#
# simple peyote setup script
# written by Arminius <[email protected]>
#
# This file is part of peyote for zsh.
#
# parameter expansion to extract the scripts home directory
home="${0%/*}"
# cd to parent location folder
cd "$home"
# print a message
msg () {
printf "[peyote] "
printf "$@ \n"
}
bailout () {
printf "ERROR: $@\n"
exit 255
}
# file/directory exists error message
fileexists () {
if [ -e "$1" ]; then
msg "File or directory exists: $1"
msg "I'm not going to overwrite it, so you have to resolve this manually."
msg "Exiting gracefully. Goodbye."
exit 1
fi
}
# check for conflicts
fileexists "$HOME/.peyote"
fileexists "$HOME/.zshrc"
mkdir -p "$HOME/.peyote"
cp -R ./ "$HOME/.peyote"
cd
ln -s .peyote/zshrc .zshrc || bailout 'Symbolic link ~/.zshrc exists, I will not touch this for you.'
msg "Setup complete. Keep in mind you have to build the peyote binary (go build peyote.go)"