Skip to content

Instantly share code, notes, and snippets.

@berngp
Created August 23, 2012 19:31
Show Gist options
  • Save berngp/3440639 to your computer and use it in GitHub Desktop.
Save berngp/3440639 to your computer and use it in GitHub Desktop.
Tools Downloads
#!/bin/bash
# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
PRGDIR=`dirname "$PRG"`
PRGDIR=`pwd $PRGDIR`
# Tools
Tools=( align collect diskstats ioprofile pmp rel sift stalk summary usl)
echo
blue=$(tput setaf 4)
green=$(tput setaf 2)
normal=$(tput sgr0)
tput bold # Bold print.
mkdir -p $PRGDIR/bin
for cmd in "${Tools[@]}"
do
cmd_path="${PRGDIR}/bin/${cmd}"
`curl -k -L http://aspersa.googlecode.com/svn/trunk/${cmd} > ${cmd_path}`
printf "%s\n" "${blue}${cmd} downloaded to ${cmd_path}.${normal}"
chmod +x ${cmd_path}
ln -sf ${cmd_path} /usr/sbin
printf '%s\n' "${green}Command ${cmd_path} Linked to /usr/sbin${normal}"
echo
done
tput sgr0 # Reset terminal.
echo
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment