Last active
November 7, 2017 09:26
-
-
Save QinMing/48cfe1e0a5b65d4c62dc2da8b91ab145 to your computer and use it in GitHub Desktop.
Dot file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# To run this file itself: | |
# wget https://gist.githubusercontent.com/QinMing/48cfe1e0a5b65d4c62dc2da8b91ab145/raw -O dotfile.sh && chmod +x dotfile.sh | |
shell=bash | |
# Print out message in color | |
success() { | |
echo -e "\033[1;32m$1\033[0m" | |
} | |
skip() { | |
# Print out message in color | |
echo -e "\033[0;33m$1\033[0m" | |
} | |
if [ -z "$1" ]; then | |
echo 'Missing arg. $1 : email' | |
exit 1 | |
fi | |
email_address=$1 | |
# Notice: Ming's name is hard coded in git_profile.sh. | |
sudo apt update && \ | |
sudo apt install git vim curl \ | |
zsh fonts-powerline \ | |
htop | |
success 'Installed packages' | |
cd $HOME | |
if [ ! -d "$HOME/git" ]; then | |
mkdir git | |
success 'Created git folder' | |
fi | |
curl -L -o git_profile.sh 'https://gist.githubusercontent.com/QinMing/997a502af8856d31b61d51fc747c551a/raw' | |
email_address=${email_address} ${shell} ./git_profile.sh | |
rm git_profile.sh | |
success 'Configured git' | |
# pip | |
if pip --version &>/dev/null; then | |
skip 'Already installed pip' | |
else | |
wget -qO - https://bootstrap.pypa.io/get-pip.py | sudo python && success 'Installed pip' | |
fi | |
# virtualenv | |
if virtualenv --version &>/dev/null; then | |
skip 'Already installed virtualenv' | |
else | |
sudo pip install virtualenv && success 'Installed virtualenv' | |
fi | |
# simple-virtualenv-wrapper | |
if [ ! -d "$HOME/git/simple-virtualenv-wrapper" ]; then | |
cd $HOME/git | |
git clone https://github.com/QinMing/simple-virtualenv-wrapper.git | |
echo "Still need to setup simple-virtualenv-wrapper in .bashrc" | |
success 'Installed simple-virtualenv-wrapper' | |
else | |
skip 'Already installed simple-virtualenv-wrapper' | |
fi | |
# vimrc | |
cd $HOME | |
curl -L -o .vimrc 'https://gist.githubusercontent.com/QinMing/d637a18dbff634e5e969/raw' | |
success 'Configured .vimrc' | |
# zsh | |
if [ ! -d "$HOME/.oh-my-zsh" ]; then | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
success 'Installed oh-my-zsh' | |
omz_branch='ming/stash' | |
cd $HOME/.oh-my-zsh | |
# this didn't work. because the upstream was fetched with --depth 1. Need manual pull | |
#git remote rename origin upstream | |
#git remote add origin [email protected]:QinMing/oh-my-zsh.git | |
#git fetch origin | |
#git checkout ${omz_branch} | |
success "Configured oh-my-zsh. (Checkout ${omz_branch} branch)" | |
else | |
skip 'Already installed oh-my-zsh' | |
fi | |
echo 'FYI, if zsh is not default, run `chsh -s $(which zsh)` and login again' | |
# bashrc / bash_profile | |
echo " ================== Example bashrc / bash_profile ========================" | |
echo 'https://gist.githubusercontent.com/QinMing/d166cfd6b4a3a078669958d832a7f22d/raw' | |
echo " ================== Example zshrc ========================" | |
echo 'https://gist.githubusercontent.com/QinMing/364774610afc0e06cc223b467abe83c0/raw' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment