Created
August 23, 2012 19:31
-
-
Save berngp/3440639 to your computer and use it in GitHub Desktop.
Tools Downloads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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