Created
October 12, 2015 00:37
-
-
Save bobo52310/ed51405923777c3dee10 to your computer and use it in GitHub Desktop.
ubuntu-bootstrap.sh 整理中...
This file contains 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 | |
# Bobo's small script to automate the setup of a webdev ubuntu box | |
sudo -v #延長 root 密碼期限5分鐘 | |
echo "=== 準備開始安裝... ===" | |
# update package sources | |
sudo apt-get update | |
# 安裝常用的工具 webdev-related software | |
sudo apt-get install -y git zsh wget curl vim tig tmux tree ack-grep | |
# 檢查目前是否使用 zsh shell | |
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') | |
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then | |
# 設定使用 zsh | |
printf "設定使用 zsh shell 作為預設 shell \n" | |
chsh -s /bin/zsh | |
fi | |
# 檢查是否安裝過 oh-my-zsh | |
if [ -d "$ZSH" ]; then | |
printf "已經有安裝 oh-my-zsh \n" | |
else | |
echo "==> Installing oh-my-zsh" | |
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh | |
fi | |
# 檢查是否能執行 PHP | |
PHP=$(which php) | |
if [ -z "$PHP" ]; then | |
echo "Could not find PHP in your path..." | |
exit 1 | |
fi | |
# 檢查是否有 composer | |
COMPOSER=$(which composer) | |
if [ -z "$COMPOSER" ]; then | |
# Install composer | |
echo "==> Installing composer" | |
curl -sS https://getcomposer.org/installer | php | |
sudo mv composer.phar /usr/local/bin/composer | |
fi | |
# 檢查是否有 icdiff | |
ICDIFF=$(which icdiff) | |
if [ -z "$ICDIFF" ]; then | |
echo "==> Installing icdiff" | |
curl -s https://raw.githubusercontent.com/jeffkaufman/icdiff/release-1.7.3/icdiff \ | |
| sudo tee /usr/local/bin/icdiff > /dev/null \ | |
&& sudo chmod ugo+rx /usr/local/bin/icdiff | |
fi | |
# TODO: sync bobo's dotfiles,使用 vcsh+mr 來管理 | |
sudo apt-get install vcsh mr | |
vcsh clone https://github.com/bobo52310/vcsh_mr.git mr | |
mr up # 執行 dotfiles 同步 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment