#!/usr/bin/env bash # Copyright (c) 2012 Dickson S. Guedes. # # This module is free software; you can redistribute it and/or modify it under # the [PostgreSQL License](http://www.opensource.org/licenses/postgresql). # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose, without fee, and without a written agreement is # hereby granted, provided that the above copyright notice and this paragraph # and the following two paragraphs appear in all copies. # # In no event shall Dickson S. Guedes be liable to any party for direct, # indirect, special, incidental, or consequential damages, including lost # profits, arising out of the use of this software and its documentation, even # if Dickson S. Guedes has been advised of the possibility of such damage. # # Dickson S. Guedes specifically disclaims any warranties, including, but not # limited to, the implied warranties of merchantability and fitness for a # particular purpose. The software provided hereunder is on an "as is" basis, # and Dickson S. Guedes has no obligations to provide maintenance, support, # updates, enhancements, or modifications. ACTUAL_DIR=`pwd` STABLE_VERSION="tags/v0.2.1" clone_repo() { echo echo -n "wait while the installer fetches pgvm's files ..." git clone git://github.com/guedes/pgvm.git $pgvm_home > /dev/null 2>&1 || { echo "sorry, pgvm could not be installed" && exit 1 } cd $pgvm_home && git checkout $STABLE_VERSION > /dev/null 2>&1 && echo " done" || { echo "sorry, your git could not checkout from '$STABLE_VERSION'" && exit 1 } } copy_repo() { from_dir=${1} cp -a $from_dir $pgvm_home } update_repo() { cd $pgvm_home git checkout $STABLE_VERSION > /dev/null 2>&1 && \ git pull origin $STABLE_VERSION > /dev/null 2>&1 || \ echo "sorry, pgvm could not checkout from '$STABLE_VERSION'" } force_clone_repo() { echo "DEPRECATED! Please use --update instead" } set_bashrc_env() { [[ -f $HOME/.bashrc ]] || touch $HOME/.bashrc egrep "source .*pgvm_env.*" $HOME/.bashrc >/dev/null \ || echo "source ${pgvm_home}/pgvm_env" >> $HOME/.bashrc } set_bash_profile_env() { [[ -f $HOME/.bash_profile ]] || touch $HOME/.bash_profile egrep "source .*pgvm_env.*" $HOME/.bash_profile >/dev/null \ || echo "source ${pgvm_home}/pgvm_env" >> $HOME/.bash_profile } set_bash_env() { echo -n "setting up the environment ..." cat > ${pgvm_home}/pgvm_env <