Commit e6f052280613eaabd932cc09d3703ab4769eb43b

Authored by mj
1 parent f3f4eb5cc1
Exists in master and in 2 other branches 02-merge, dev

IMP sys_base_install.sh

Showing 1 changed file with 1 additions and 1 deletions Inline Diff

tools/sys_base_install.sh
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 2
3 # ** Initiate with: ** 3 # ** Initiate with: **
4 # cd && wget http://git.str8.biz/mj/zsh-config/raw/master/tools/sys_base_install.sh -O - | sh 4 # cd && wget http://git.str8.biz/mj/zsh-config/raw/master/tools/sys_base_install.sh -O - | sh
5 # ------------------------------------------------------------------------------------------- 5 # -------------------------------------------------------------------------------------------
6 6
7 # ** Helper Functions ** 7 # ** Helper Functions **
8 # ---------------------- 8 # ----------------------
9 9
10 export GJ_DEVENV="local_aptproxy" 10 export GJ_DEVENV="local_aptproxy"
11 export GJ_SHELL="bash" 11 export GJ_SHELL="bash"
12 12
13 function set_apt_proxy { 13 function set_apt_proxy {
14 if [ "$GJ_DEVENV" == "local_aptproxy" ]; then 14 if [ "$GJ_DEVENV" == "local_aptproxy" ]; then
15 echo "Setting apt-proxy: srvths" 15 echo "Setting apt-proxy: srvths"
16 printf 'Acquire::http { Proxy "http://192.168.188.110:3142"; };\nAcquire::https { Proxy "https://"; };\n' > /etc/apt/apt.conf.d/02proxy 16 printf 'Acquire::http { Proxy "http://192.168.188.110:3142"; };\nAcquire::https { Proxy "https://"; };\n' > /etc/apt/apt.conf.d/02proxy
17 elif [ "$GJ_DEVENV" == "hetzner_server" ]; then 17 elif [ "$GJ_DEVENV" == "hetzner_server" ]; then
18 echo "Setting apt-mirror: hetzner mirror" 18 echo "Setting apt-mirror: hetzner mirror"
19 echo 'deb ftp://mirror.hetzner.de/debian/packages wheezy main contrib non-free' > /etc/apt/sources.list.d/hetzner.list 19 echo 'deb ftp://mirror.hetzner.de/debian/packages wheezy main contrib non-free' > /etc/apt/sources.list.d/hetzner.list
20 echo 'deb ftp://mirror.hetzner.de/debian/security wheezy/updates main contrib non-free' >> /etc/apt/sources.list.d/hetzner.list 20 echo 'deb ftp://mirror.hetzner.de/debian/security wheezy/updates main contrib non-free' >> /etc/apt/sources.list.d/hetzner.list
21 fi 21 fi
22 } 22 }
23 23
24 function get_shell_config { 24 function get_shell_config {
25 apt-get -yq install curl git nano zsh 25 apt-get -yq install curl git nano zsh
26 mkdir "~/.config" 26 mkdir "~/.config"
27 echo "cloning zsh config.." 27 echo "cloning zsh config.."
28 hash git >/dev/null 2>&1 && env git clone --depth=1 http://git.str8.biz/mj/zsh-config.git $ZCNF || 28 hash git >/dev/null 2>&1 && env git clone --depth=1 http://git.str8.biz/mj/zsh-config.git $ZCNF
29 } 29 }
30 30
31 set_apt_proxy 31 set_apt_proxy
32 32
33 set -e 33 set -e
34 34
35 if [ ! -n "$ZCNF" ]; then 35 if [ ! -n "$ZCNF" ]; then
36 ZCNF=~/.config/zsh-config 36 ZCNF=~/.config/zsh-config
37 fi 37 fi
38 38
39 if [ ! -n "$ZSH" ]; then 39 if [ ! -n "$ZSH" ]; then
40 ZSH=$ZCNF/tools/oh-my-zsh 40 ZSH=$ZCNF/tools/oh-my-zsh
41 fi 41 fi
42 42
43 export DEBIAN_FRONTEND=noninteractive 43 export DEBIAN_FRONTEND=noninteractive
44 44
45 apt-get update 45 apt-get update
46 46
47 if [ "$GJ_SHELL" != "zsh" ]; then 47 if [ "$GJ_SHELL" != "zsh" ]; then
48 get_shell_config 48 get_shell_config
49 src 49 src
50 fi 50 fi
51 51
52 apt-get -yq upgrade && apt-get -yq dist-upgrade 52 apt-get -yq upgrade && apt-get -yq dist-upgrade
53 apt-get -yq autoremove && apt-get -yq clean 53 apt-get -yq autoremove && apt-get -yq clean
54 54
55 55
56 echo "\033[0;34mLooking for an existing zsh config...\033[0m" 56 echo "\033[0;34mLooking for an existing zsh config...\033[0m"
57 if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then 57 if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
58 echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-zsh-cnf\033[0m"; 58 echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-zsh-cnf\033[0m";
59 mv ~/.zshrc ~/.zshrc.pre-zsh-cnf; 59 mv ~/.zshrc ~/.zshrc.pre-zsh-cnf;
60 fi 60 fi
61 61
62 echo "\033[0;34mUsing the Zsh Config template file and adding it to ~/.zshrc\033[0m" 62 echo "\033[0;34mUsing the Zsh Config template file and adding it to ~/.zshrc\033[0m"
63 ln -s $ZCNF/templates/zshrc ~/.zshrc 63 ln -s $ZCNF/templates/zshrc ~/.zshrc
64 ln -s $ZCNF/templates/bash_aliases ~/.bash_aliases 64 ln -s $ZCNF/templates/bash_aliases ~/.bash_aliases
65 sed -i -e "/^export ZSH=/ c\\ 65 sed -i -e "/^export ZSH=/ c\\
66 export ZSH=$ZSH 66 export ZSH=$ZSH
67 " ~/.zshrc 67 " ~/.zshrc
68 68
69 echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" 69 echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
70 sed -i -e "/export PATH=/ c\\ 70 sed -i -e "/export PATH=/ c\\
71 export PATH=\"$PATH\" 71 export PATH=\"$PATH\"
72 " ~/.zshrc 72 " ~/.zshrc
73 73
74 if [ "$SHELL" != "$(which zsh)" ]; then 74 if [ "$SHELL" != "$(which zsh)" ]; then
75 echo "\033[0;34mTime to change your default shell to zsh!\033[0m" 75 echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
76 chsh -s `which zsh` 76 chsh -s `which zsh`
77 fi 77 fi
78 78
79 echo "\033[0;32m"' __ __ '"\033[0m" 79 echo "\033[0;32m"' __ __ '"\033[0m"
80 echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" 80 echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
81 echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" 81 echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m"
82 echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" 82 echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m"
83 echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" 83 echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m"
84 echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m" 84 echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m"
85 echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m" 85 echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m"
86 echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m" 86 echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m"
87 echo "\n\n \033[0;32mp.p.s. Get stickers and t-shirts at http://shop.planetargon.com.\033[0m" 87 echo "\n\n \033[0;32mp.p.s. Get stickers and t-shirts at http://shop.planetargon.com.\033[0m"
88 env zsh 88 env zsh
89 . ~/.zshrc 89 . ~/.zshrc
90 90