-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.zsh
executable file
·28 lines (23 loc) · 873 Bytes
/
setup.zsh
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
#!/bin/bash
# initialises paths to effectivley use scripts within joshhighet/kerchow
set -e #-x
location=`timeout .1 git rev-parse --show-toplevel`
if [[ ! "${SHELL}" =~ "zsh" ]] ; then
echo "setup needs to be executed from within zsh"
exit 1
fi
if [[ ! "${location}" =~ "kerchow" ]] ; then
echo "setup needs to be executed from within joshhighet/kerchow"
exit 1
fi
if ! grep "kerchow/sbin" ~/.zshrc &>/dev/null ; then
cd "${location}/sbin"
cp ~/.zshrc ~/.zshrc-backup-joshhighet-kerchow-sbin
echo "kerchow/sbin not in path, adding"
echo "" >> ~/.zshrc
echo "# added by setup.zsh from joshhighet/kerchow" >> ~/.zshrc
echo "export PATH=${location}/sbin:\$PATH" >> ~/.zshrc
echo "added, reopen your terminal or introduce into current session with 'source ~/.zshrc'"
else
echo "computer says no - have you already set this up?"
fi