rmsfab /

#!/usr/bin/env bash

function echorun {
    echo $*

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

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

# 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
    echo -n "Human name: " ; read name
    echo -n "Email address: "; read email
    echo "
username = $name <$email>
verbose = True
" >> $HOME/.hgrc
    git config --global "$name"
    git config --global "$email"
    echo ~/.hgrc already has a \[ui\] section, skipping hg/git user/email setup

# 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'