Commit f3f4eb5cc1340b609f2119fa22be5e05aabc22aa

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

IMP sys_base_install.sh

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

tools/sys_base_install.sh
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 2
3 # ** Initiate with: **
4 # cd && wget http://git.str8.biz/mj/zsh-config/raw/master/tools/sys_base_install.sh -O - | sh
5 # -------------------------------------------------------------------------------------------
6
3 # ** Helper Functions ** 7 # ** Helper Functions **
4 # ---------------------- 8 # ----------------------
5 9
6 GJ_DEVENV="local_aptproxy" 10 export GJ_DEVENV="local_aptproxy"
7 GJ_SHELL="bash" 11 export GJ_SHELL="bash"
8 12
9 function set_apt_proxy { 13 function set_apt_proxy {
10 if [ "$GJ_DEVENV" == "local_aptproxy" ]; then 14 if [ "$GJ_DEVENV" == "local_aptproxy" ]; then
11 echo "Setting apt-proxy: srvths" 15 echo "Setting apt-proxy: srvths"
12 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
13 elif [ "$GJ_DEVENV" == "hetzner_server" ]; then 17 elif [ "$GJ_DEVENV" == "hetzner_server" ]; then
14 echo "Setting apt-mirror: hetzner mirror" 18 echo "Setting apt-mirror: hetzner mirror"
15 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
16 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
17 fi 21 fi
18 } 22 }
19 23
20 function get_shell_config { 24 function get_shell_config {
21 apt-get -yq install curl git nano zsh 25 apt-get -yq install curl git nano zsh
22 mkdir "~/.config" 26 mkdir "~/.config"
23 echo "cloning zsh config.." 27 echo "cloning zsh config.."
24 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 ||
25 } 29 }
26 30
27 set_apt_proxy 31 set_apt_proxy
28 32
29 set -e 33 set -e
30 34
31 if [ ! -n "$ZCNF" ]; then 35 if [ ! -n "$ZCNF" ]; then
32 ZCNF=~/.config/zsh-config 36 ZCNF=~/.config/zsh-config
33 fi 37 fi
34 38
35 if [ ! -n "$ZSH" ]; then 39 if [ ! -n "$ZSH" ]; then
36 ZSH=$ZCNF/tools/oh-my-zsh 40 ZSH=$ZCNF/tools/oh-my-zsh
37 fi 41 fi
38 42
39 export DEBIAN_FRONTEND=noninteractive 43 export DEBIAN_FRONTEND=noninteractive
40 44
41 apt-get update 45 apt-get update
42 46
43 if [ "$GJ_SHELL" != "zsh" ]; then 47 if [ "$GJ_SHELL" != "zsh" ]; then
44 get_shell_config 48 get_shell_config
45 src 49 src
46 fi 50 fi
47 51
48 apt-get -yq upgrade && apt-get -yq dist-upgrade 52 apt-get -yq upgrade && apt-get -yq dist-upgrade
49 apt-get -yq autoremove && apt-get -yq clean 53 apt-get -yq autoremove && apt-get -yq clean
50 54
51 55
52 echo "\033[0;34mLooking for an existing zsh config...\033[0m" 56 echo "\033[0;34mLooking for an existing zsh config...\033[0m"
53 if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then 57 if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
54 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";
55 mv ~/.zshrc ~/.zshrc.pre-zsh-cnf; 59 mv ~/.zshrc ~/.zshrc.pre-zsh-cnf;
56 fi 60 fi
57 61
58 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"
59 ln -s $ZCNF/templates/zshrc ~/.zshrc 63 ln -s $ZCNF/templates/zshrc ~/.zshrc
60 ln -s $ZCNF/templates/bash_aliases ~/.bash_aliases 64 ln -s $ZCNF/templates/bash_aliases ~/.bash_aliases
61 sed -i -e "/^export ZSH=/ c\\ 65 sed -i -e "/^export ZSH=/ c\\
62 export ZSH=$ZSH 66 export ZSH=$ZSH
63 " ~/.zshrc 67 " ~/.zshrc
64 68
65 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"
66 sed -i -e "/export PATH=/ c\\ 70 sed -i -e "/export PATH=/ c\\
67 export PATH=\"$PATH\" 71 export PATH=\"$PATH\"
68 " ~/.zshrc 72 " ~/.zshrc
69 73
70 if [ "$SHELL" != "$(which zsh)" ]; then 74 if [ "$SHELL" != "$(which zsh)" ]; then
71 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"
72 chsh -s `which zsh` 76 chsh -s `which zsh`
73 fi 77 fi
74 78
75 echo "\033[0;32m"' __ __ '"\033[0m" 79 echo "\033[0;32m"' __ __ '"\033[0m"
76 echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" 80 echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
77 echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" 81 echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m"
78 echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" 82 echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m"
79 echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" 83 echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m"
80 echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m" 84 echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m"
81 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"
82 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"
83 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"
84 env zsh 88 env zsh
85 . ~/.zshrc 89 . ~/.zshrc
86 90