#!/bin/bash -e function usage() { cat <> ~/.bashrc ;; list) for t in * do [ ! -e "$t/install" ] && continue echo $t done ;; bin) cd bin ln -sf ../$TOOL/bin/* . echo "TOOLS | $TOOL | bin symlinks updated" cd .. ;; install) cd $TOOL if git status --ignored . | egrep -q 'Untracked|Ignored' then echo "TOOLS | $TOOL | appears to already be installed. Uninstall first?" exit 0 fi echo "TOOLS | $TOOL | starting install" [ -x ./install-root -a "$ALLOW_SUDO" -eq 1 ] && sudo ./install-root ./install echo "TOOLS | $TOOL | install finished" cd .. $0 bin $TOOL ;; uninstall) cd $TOOL [ -x ./uninstall ] && ./uninstall git clean -dffx . echo "TOOLS | $TOOL | uninstall finished" cd .. ;; upgrade) cd $TOOL if [ -x ./upgrade ] then ./upgrade echo "TOOLS | $TOOL | upgrade complete!" else echo "TOOLS | $TOOL | no upgrade script -- reinstalling" $0 uninstall $TOOL $0 install $TOOL fi ;; *) echo "TOOLS | ERROR | unknown action $ACTION" ;; esac