Commit 06f62e7a74540f827308c00bfb139f778a73b89d
1 parent
21d27c3db2
Exists in
master
and in
2 other branches
IMP sys_base_install.sh
Showing 1 changed file with 11 additions and 5 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 apt-utils 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 | ||
| 50 | fi | 49 | fi |
| 51 | 50 | ||
| 52 | apt-get -yq upgrade && apt-get -yq dist-upgrade | 51 | apt-get -yq upgrade && apt-get -yq dist-upgrade |
| 52 | apt-get -yq install locales-all localepurge makepasswd python-setuptools | ||
| 53 | apt-get -yq autoremove && apt-get -yq clean | 53 | apt-get -yq autoremove && apt-get -yq clean |
| 54 | 54 | ||
| 55 | dpkg-reconfigure localepurge | ||
| 56 | dpkg-reconfigure tzdata | ||
| 57 | |||
| 58 | easy_install pip | ||
| 59 | pip install autoenv | ||
| 60 | mkdir .autoenv && ln -s /usr/local/bin/activate.sh .autoenv/activate.sh | ||
| 55 | 61 | ||
| 56 | echo "\033[0;34mLooking for an existing zsh config...\033[0m" | 62 | echo "\033[0;34mLooking for an existing zsh config...\033[0m" |
| 57 | if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then | 63 | 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"; | 64 | 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; | 65 | mv ~/.zshrc ~/.zshrc.pre-zsh-cnf; |
| 60 | fi | 66 | fi |
| 61 | 67 | ||
| 62 | echo "\033[0;34mUsing the Zsh Config template file and adding it to ~/.zshrc\033[0m" | 68 | echo "\033[0;34mUsing the Zsh Config template file and adding it to ~/.zshrc\033[0m" |
| 63 | ln -s $ZCNF/templates/zshrc ~/.zshrc | 69 | ln -s $ZCNF/templates/zshrc ~/.zshrc |
| 64 | ln -s $ZCNF/templates/bash_aliases ~/.bash_aliases | 70 | ln -s $ZCNF/templates/bash_aliases ~/.bash_aliases |
| 65 | sed -i -e "/^export ZSH=/ c\\ | 71 | sed -i -e "/^export ZSH=/ c\\ |
| 66 | export ZSH=$ZSH | 72 | export ZSH=$ZSH |
| 67 | " ~/.zshrc | 73 | " ~/.zshrc |
| 68 | 74 | ||
| 69 | echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" | 75 | 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\\ | 76 | sed -i -e "/export PATH=/ c\\ |
| 71 | export PATH=\"$PATH\" | 77 | export PATH=\"$PATH\" |
| 72 | " ~/.zshrc | 78 | " ~/.zshrc |
| 73 | 79 | ||
| 74 | if [ "$SHELL" != "$(which zsh)" ]; then | 80 | if [ "$SHELL" != "$(which zsh)" ]; then |
| 75 | echo "\033[0;34mTime to change your default shell to zsh!\033[0m" | 81 | echo "\033[0;34mTime to change your default shell to zsh!\033[0m" |
| 76 | chsh -s `which zsh` | 82 | chsh -s `which zsh` |
| 77 | fi | 83 | fi |
| 78 | 84 | ||
| 79 | echo "\033[0;32m"' __ __ '"\033[0m" | 85 | echo "\033[0;32m"' __ __ '"\033[0m" |
| 80 | echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" | 86 | echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" |
| 81 | echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" | 87 | echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" |
| 82 | echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" | 88 | echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" |
| 83 | echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" | 89 | echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" |
| 84 | echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m" | 90 | 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" | 91 | 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" | 92 | 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" | 93 | echo "\n\n \033[0;32mp.p.s. Get stickers and t-shirts at http://shop.planetargon.com.\033[0m" |
| 88 | env zsh | 94 | env zsh |
| 89 | . ~/.zshrc | 95 | . ~/.zshrc |