Last active
September 3, 2020 18:49
-
-
Save yuasatakayuki/8176d73f7e716f95587b to your computer and use it in GitHub Desktop.
Heasoft download, build, and install script
This file contains 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 | |
cat << EOF | |
#============================================ | |
# Heasoft download, build, and install script | |
# | |
# For the latest version of this script, visit the gist: | |
# https://gist.github.com/yuasatakayuki/8176d73f7e716f95587b | |
# | |
# This script uses the Heasoft mirror hosted at the JAXA/ISAS. | |
# The original locatoin is http://heasarc.nasa.gov/lheasoft/ . | |
#============================================ | |
EOF | |
if [ _$1 = _ ]; then | |
echo "Provide install destination (e.g. /usr/local)." | |
exit -1 | |
fi | |
install_prefix=$1 | |
if [ ! -d $install_prefix ]; then | |
echo "Install destination not found." | |
read -p "Would you like to create ${install_prefix}? yes/no >" yesOrNo | |
if [ $yesOrNo = yes ]; then | |
mkdir -p $install_prefix | |
if [ ! -f $install_prefix ]; then | |
echo "Error: failed to create $install_prefix" | |
exit -1 | |
else | |
echo "$install_prefix created." | |
fi | |
else | |
echo "Exiting" | |
exit -1 | |
fi | |
fi | |
version=6.16 | |
url=http://darts.isas.jaxa.jp/pub/legacy.gsfc.nasa.gov/software/lheasoft/lheasoft${version}/heasoft-${version}src.tar.gz | |
gzFile=`basename $url` | |
dir=`basename $gzFile src.tar.gz` | |
#--------------------------------------------- | |
# download | |
#--------------------------------------------- | |
if [ ! -f $dir ]; then | |
if [ ! -f $gzFile ]; then | |
echo "Downloading..." | |
wget $url | |
fi | |
if [ ! -f $gzFile ]; then | |
echo "Download failed." | |
exit -1 | |
fi | |
fi | |
#--------------------------------------------- | |
# unzip/tar xf | |
#--------------------------------------------- | |
if [ ! -d $dir ]; then | |
echo "Unzipping..." | |
tar zxf $gzFile | |
fi | |
if [ ! -d $dir ]; then | |
echo "Unzipping failed." | |
exit -1 | |
fi | |
#--------------------------------------------- | |
# configure/make/make install | |
#--------------------------------------------- | |
cd $dir/BUILD_DIR | |
echo "Configuring... (message saved in log_configure)" | |
./configure --prefix=${install_prefix} 2>&1 > log_configure | |
echo "Executing make (message saved in log_make)" | |
make 2>&1 > log_make | |
echo "Executing make install (message saved in log_make_install)" | |
make install 2>&1 > log_make_install | |
cd - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment