#!/bin/bash
echo "Finish up GSAS-II installation, version **Version**"
# create shortcut to bootstrap script =======================================================
echo "# Commands to run GSAS-II load/update process" > $PREFIX/start_G2_bootstrap.sh
echo "source $PREFIX/bin/activate" >> $PREFIX/start_G2_bootstrap.sh
echo "$PREFIX/bin/python $PREFIX/GSASII/bootstrap.py" >> $PREFIX/start_G2_bootstrap.sh
# constructor fixups: missing empty directories & changed binary files ======================
mkdir -p $PREFIX/GSASII/.svn/tmp
$PREFIX/bin/svn revert $PREFIX/GSASII/bindist/*
#
# update the GSAS-II package if possible, create shortcuts & byte-compile... ================
echo "launching bootstrap process"
# try to update to latest GSAS-II version (will fail if no network)
#$PREFIX/bin/python $PREFIX/GSASII/bootstrap.py --noinstall >> $PREFIX/GSASII/conda_inst.log 2>&1
$PREFIX/bin/python $PREFIX/GSASII/bootstrap.py --noinstall
# finish installation
#$PREFIX/bin/python $PREFIX/GSASII/bootstrap.py --nonet > $PREFIX/GSASII/conda_inst.log 2>&1
$PREFIX/bin/python $PREFIX/GSASII/bootstrap.py --nonet
# create shortcut to start GSAS-II     =======================================================
echo "# Commands to start GSAS-II" > $PREFIX/start_GSASII.sh
echo "source $PREFIX/bin/activate" >> $PREFIX/start_GSASII.sh
if [ -e $PREFIX/bin/pythonw ]
then
   echo "$PREFIX/bin/pythonw $PREFIX/GSASII/GSASII.py" >> $PREFIX/start_GSASII.sh
else
   echo "$PREFIX/bin/python $PREFIX/GSASII/GSASII.py" >> $PREFIX/start_GSASII.sh
fi
echo "GSAS-II installer, version **Version** completed"
#MACOnly# echo "*** Viewing GSAS-II app in Finder; you may wish to drag it to the dock.***"
