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