Created
December 12, 2012 12:35
-
-
Save TaurusOlson/4267411 to your computer and use it in GitHub Desktop.
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 | |
die () { echo "$@"; exit; } | |
usage () { | |
cat <<USAGE | |
Description: | |
Setup the current hcss track and build to the environment | |
by creating a symlink to the wanted hcss build directory. | |
Usage: | |
$(basename $0) <origin> <instrument> <track> <build> | |
Example: | |
$(basename $0) icc hifi 8.0 2931 | |
USAGE | |
exit | |
} | |
if [[ $# -eq 4 ]]; then | |
ORIGIN=$1 | |
INSTRUMENT=$2 | |
TRACK=$3 | |
BUILD=$4 | |
# Checks | |
[ $ORIGIN != 'icc' ] &&\ | |
[ $ORIGIN != 'dp' ] && die "Choose between icc or dp." | |
[ $INSTRUMENT != 'hifi' ] &&\ | |
[ $INSTRUMENT != 'spire' ] &&\ | |
[ $INSTRUMENT != 'pacs' ] && die "Choose between hifi spire or pacs." | |
export HCSS_CURRENT=$HOME/hcss/hcss.$ORIGIN.$INSTRUMENT-$TRACK.$BUILD | |
export PATH=$PATH:$HOME/hcss_current/bin | |
[ ! -d $HCSS_CURRENT ] && die "$HCSS_CURRENT doesn't exist" | |
[ -e $HOME/hcss_current ] && rm -f $HOME/hcss_current | |
ln -s $HCSS_CURRENT $HOME/hcss_current && echo -e "Setup OK.\nhcss_current = hcss.$ORIGIN.$INSTRUMENT-$TRACK.$BUILD" | |
else | |
usage | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment