forked from PeterDaveHello/Unitial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·82 lines (68 loc) · 3.44 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/sh
CAT="/bin/cat"
CHMOD="/bin/chmod"
MKDIR="/bin/mkdir"
RM="/bin/rm"
github_base='https://cdn.rawgit.com/'
#github_base='https://raw.githubusercontent.com/'
repo_path='PeterDaveHello/Unitial/master/'
os=`uname`
if [ $os = "FreeBSD" ];then
ECHO="echo"
${ECHO} -e "\n\e[1;36;40mYour operating system is $os\n\e[0m";
${ECHO} -e "\n\e[1;36;40mSuppose you have 'fetch' to download files!\n\e[0m";
download='fetch'
download_o='fetch -o'
else
ECHO="/bin/echo"
${ECHO} -e "\n\e[1;36;40mYour operating system is $os\n\e[0m";
${ECHO} -e "\n\e[1;36;40mSuppose you have 'curl' to download files!\n\e[0m";
download='curl -kO'
download_o='curl -ko'
fi
${ECHO} -e "\n\e[1;36;40mUnitial is started to initial your Unix-like working environment\n\nPlease wait...\n\n\e[0m";
${ECHO} -e "\n\e[1;36;40mDownload and setup configs from server...\n\e[0m";
for files in gitconfig tcshrc bashrc bash_profile inputrc vimrc zshrc gitignore_global tmux.conf
do
${download} "$github_base""$repo_path""$files"
${CAT} "$files" >> ~/."$files"
${RM} "$files"
done
${MKDIR} -p ~/.irssi/ ~/.git/contrib/ ~/.vim/colors/ ~/.vim/swp/ ~/.vim/bak/ ~/.vim/undo/
${download_o} ~/.irssi/config "$github_base""$repo_path"irssi_config
${download} "$github_base""$repo_path"ssh_config
${MKDIR} -p -m 700 ~/.ssh/.tmp_session/
${CAT} ssh_config >> ~/.ssh/config
${RM} ssh_config
${ECHO} -e "\n\e[1;36;40mAdd some color setting which depends on your OS...\n\e[0m";
if [ $os = "FreeBSD" ] || [ $os = "Darwin" ];then
${ECHO} -e "\n#color setting\nalias ls='\ls -F'" >> ~/.zshrc
${ECHO} -e "\n#color setting\nalias ls '\ls -F'" >> ~/.tcshrc
else
${ECHO} -e "\n#color setting\nalias ls='\ls -F --color=auto'" >> ~/.zshrc
${ECHO} -e "\n#color setting\nalias ls '\ls -F --color=auto'" >> ~/.tcshrc
fi
if [ $os = "FreeBSD" ];then
${ECHO} -e "\n\e[1;36;40mAdd FreeBSD's package mirror setting...\n\e[0m";
${ECHO} -e "\n#package mirror setting\nexport PACKAGEROOT=http://ftp.tw.freebsd.org" >> ~/.bashrc
${ECHO} -e "\n#package mirror setting\nexport PACKAGEROOT=http://ftp.tw.freebsd.org" >> ~/.zshrc
${ECHO} -e "\n#package mirror setting\nsetenv PACKAGEROOT http://ftp.tw.freebsd.org" >> ~/.tcshrc
fi
${ECHO} -e "\n\e[1;36;40mDownload VIM color scheme - Kolor from server...\n\e[0m";
${download_o} ~/.vim/colors/kolor.vim "$github_base"zeis/vim-kolor/master/colors/kolor.vim
${ECHO} -e "\n\e[1;36;40mDownload git contrib - diff-highlight from server...\n\e[0m";
${download_o} ~/.git/contrib/diff-highlight "$github_base"git/git/master/contrib/diff-highlight/diff-highlight
${CHMOD} +x ~/.git/contrib/diff-highlight
${ECHO} -e "\n\e[1;36;40mDownload git's auto completion configs from server...\n\e[0m";
git_auto_complete_path="$github_base"'git/git/master/contrib/completion/git-completion.'
${download_o} ~/.git-completion.bash "$git_auto_complete_path"bash
${download_o} ~/.git-completion.tcsh "$git_auto_complete_path"tcsh
${download_o} ~/.git-completion.zsh "$git_auto_complete_path"zsh
if [ $os = "FreeBSD" ] && [ -r /usr/local/share/certs/ca-root-nss.crt ];then
${ECHO} -e "\n\e[1;36;40mAdd ca-certificate path for FreeBSD's wget...\n\e[0m";
${ECHO} -e "\nca-certificate=/usr/local/share/certs/ca-root-nss.crt" >> ~/.wgetrc
fi
if [ "$SHELL" = "/bin/bash" ] || [ "$SHELL" = "/usr/local/bin/bash" ] ; then
. ~/.bashrc
fi
${ECHO} -e "\n\e[1;36;40mUnitial installation was finished!\n\nPlease terminate all other works and restart your shell or re-login.\n\e[0m";