Source

rmsfab / bootstrap.sh

#!/usr/bin/env bash

function echorun {
    echo $*
    $*
}

if [ "$SHELL" != "/bin/bash" ] ; then
    echo Invoked via $SHELL ...
    echo Please invoke with bash
    exit 1
fi

#
# Install some Ubuntu dev essentials, inc a system fabric install, via pip
#
echo
echo setting up some initial packages and scm...
echo you\'ll need to give sudo appropriate credentials
echo

# basic scm tools
echorun sudo apt-get -q --yes install mercurial git subversion

# setup initial .hgrc and git id
if ! grep '\[ui\]' $HOME/.hgrc &>/dev/null ; then
    echo creating ~/.hgrc \[ui\] section, git config user.name/email
    echo -n "Human name: " ; read name
    echo -n "Email address: "; read email
    echo "
[ui]
username = $name <$email>
verbose = True
" >> $HOME/.hgrc
    git config --global user.name "$name"
    git config --global user.email "$email"
else
    echo ~/.hgrc already has a \[ui\] section, skipping hg/git user/email setup
fi

# ssh server, on which fabric relies, and curl, which gets used here-n-there
echorun sudo apt-get -q --yes install openssh-server curl

# python, pip & fabric
echorun sudo apt-get -q --yes install build-essential python-setuptools python-dev python-software-properties
echorun sudo easy_install pip     # no pip package in ubuntu < 10, so use easy_install
echorun sudo pip install --upgrade 'fabric>=1.0'