forked from sangrealest/shell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_zsh.sh
More file actions
executable file
·81 lines (72 loc) · 1.67 KB
/
init_zsh.sh
File metadata and controls
executable file
·81 lines (72 loc) · 1.67 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
#Author:Shanker
#set -x
#set -u
clear
echo ""
echo "#############################################################"
echo "# Automatically to Install oh-my-zsh and initialize it #"
echo "# Intro: https://github.com/sangrealest/shanker #"
echo "# Author: Shanker<shanker@yeah.net> #"
echo "#############################################################"
echo ""
#if [ `id -u` -ne 0 ]
#then
# echo "Need root to run is, try with sudo"
# exit 1
#fi
function checkOs(){
if [ -f /etc/redhat-release ]
then
OS="CentOS"
elif [ ! -z "`cat /etc/issue | grep -i bian`" ]
then
OS="Debian"
elif [ ! -z "`cat /etc/issue | grep -i ubuntu`" ]
then
OS="Ubuntu"
else
echo "Not supported OS"
exit 1
fi
}
function installSoftware(){
if [ "$OS" == 'CentOS' ]
then
sudo yum -y install zsh git
else
sudo apt-get -y install zsh git
fi
zshPath="`which zsh`"
user=$(whoami)
}
function downloadFile(){
cd ~
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
git clone https://github.com/joelthelion/autojump.git
git clone https://github.com/sangrealest/initzsh
}
function installAutojump(){
cd ~/autojump
./install.py
cat >>~/.zshrc<<EOF
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && source ~/.autojump/etc/profile.d/autojump.sh
autoload -U compinit && compinit -u
EOF
}
function configZsh(){
if [ -f ".zsh_history" ]
then
mv .zsh_history{.,backup}
fi
sudo usermod -s "$zshPath" $user
cp ~/initzsh/zshrc ~/.zshrc
}
function main(){
checkOs
installSoftware
downloadFile
configZsh
installAutojump
}
main