Bash
The Bash equivalent of the above is:
#=== Determine our system ==========
# Determine what operating system we are using
OS_DIST=`uname -s`;
# Figure out what distro and version we are running
if [ "$OS_DIST" = "Linux" ]; then
if [ -f /etc/SuSE-release ]; then
OS_NAME='SuSE'
if [[ `cat /etc/SuSE-release | grep openSUSE` ]]; then
OS_VERS=`head -n 1 /etc/SuSE-release | sed 's/[\(\)]//g' | awk '{print "_" $3 "-" $2}'`
else
OS_VERS=`head -n 1 /etc/SuSE-release | awk '{print $3; }'`
fi
elif [ -f /etc/fedora-release ]; then
OS_NAME='Fedora'
OS_VERS=`head -n 1 /etc/fedora-release | awk '{print $5; }'`
elif [ -f /etc/redhat-release ]; then
OS_NAME='Redhat'
OS_VERS=`head -n 1 /etc/redhat-release | awk '{print $5; }'`
elif [ -f /etc/debian_version ]; then
OS_NAME='Debian'
OS_VERS=`head -n 1 /etc/debian_version | awk '{print $1; }'`
else
OS_NAME='None'
OS_VERS='0'
fi
else
# If other (namely Sun and Apple), then use the uname results
OS_NAME=${OS_DIST}
OS_VERS=`uname -r`
fi
# Set the system name to locate our binaries with
export USERPKGARCHSYS=${OS_NAME}${OS_VERS}
#=== Set use system ================
# Set generic location and description
#export USERPKGBASE=/imager/project/ModelingAndRendering/Packages
export USERPKGBASE=/ubc/cs/research/imager/project/psm/Packages
export USERPKGROOT=${USERPKGBASE}/Generic
export USERPKGDESC='PSM Lab software'
# Set architecture directory based on what system you are on
export USERPKGARCH=${USERPKGBASE}/Arch/${USERPKGARCHSYS}
|