-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·64 lines (53 loc) · 1.17 KB
/
setup.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
RED='\033[0;31m'
NC='\033[0m'
gitConfig=false
profileSetup=false
while [ $# -gt 0 ]
do
key="$1"
case $key in
-git)
gitConfig=true
shift
;;
-profile)
profileSetup=true
shift
;;
*)
shift
;;
esac
done
if [ $gitConfig = true ]; then
if [ ! which git -eq "" ]; then
git config --global alias.ci commit
git config --global alias.co checkout
git config --global alias.st status
git config --global alias.lg 'log --oneline --graph --decorate'
git config --global alias.lgs 'log --oneline --graph --decorate --stat'
git config --global core.editor 'vim'
fi
fi
if [ $profileSetup = true ]; then
if [ $HOME = "" ]; then
HOME = '~'
fi
# check for existing .profile
if [ -e $HOME/.profile ]; then
mv $HOME/.profile $HOME/.old_profile
fi
# check for existing zsh config
if [ -e $HOME/.zshrc ]; then
mv $HOME/.zshrc $HOME/.old_zshrc
fi
# check whethe zsh is installed
if [ ! which zsh -eq "" ]; then
echo -e "${RED}warning:\tno zsh installed${NC}"
fi
cp -r .profile $HOME/
fi
if [ $gitConfig = false ] && [ $profileSetup = false ]; then
echo "usage: setup.sh -git -profile"
fi