2014-04-02 00:11:14 +05:30
|
|
|
#!/usr/bin/env bash
|
2010-05-06 19:47:53 +05:30
|
|
|
|
2016-07-15 14:24:28 +05:30
|
|
|
SCRIPTLOCATION="$( cd "$( dirname "$0" )" && pwd )"
|
|
|
|
DAMASK_ROOT=$SCRIPTLOCATION/../../
|
2014-01-12 22:59:00 +05:30
|
|
|
|
2014-10-22 13:15:52 +05:30
|
|
|
if [ "x$MSC_ROOT" != "x" ]; then
|
|
|
|
DEFAULT_DIR=$MSC_ROOT
|
|
|
|
fi
|
2016-07-15 14:24:28 +05:30
|
|
|
if [ "x$MARC_VERSION" != "x" ]; then
|
|
|
|
DEFAULT_VERSION=$MARC_VERSION
|
|
|
|
fi
|
|
|
|
if [ "x$DAMASK_BIN" != "x" ]; then
|
2020-01-14 03:56:40 +05:30
|
|
|
BIN_DIR=$DAMASK_ROOT/bin
|
2016-07-15 14:24:28 +05:30
|
|
|
fi
|
2014-10-22 13:15:52 +05:30
|
|
|
|
2016-07-15 14:24:28 +05:30
|
|
|
while [ ! -d "$SCRIPTLOCATION/$VERSION" ] || [ -z "$VERSION" ]
|
2011-10-20 21:43:38 +05:30
|
|
|
do
|
|
|
|
echo "Input version of MARC/MENTAT installation: [${DEFAULT_VERSION}]"
|
|
|
|
read VERSION
|
|
|
|
if [ -z "$VERSION" ]; then
|
|
|
|
VERSION=${DEFAULT_VERSION}
|
|
|
|
fi
|
2017-02-11 05:02:02 +05:30
|
|
|
[[ -d "$SCRIPTLOCATION/$VERSION" ]] || echo -e "$VERSION not supported..!\n"
|
2011-10-20 21:43:38 +05:30
|
|
|
done
|
|
|
|
echo "MSC version: $VERSION"
|
|
|
|
|
|
|
|
while [ ! -d "$INSTALLDIR" ] || [ -z "$INSTALLDIR" ]
|
|
|
|
do
|
2014-10-22 13:15:52 +05:30
|
|
|
echo "Input path of MARC/MENTAT installation: [${DEFAULT_DIR}]"
|
2011-10-20 21:43:38 +05:30
|
|
|
read INSTALLDIR
|
2014-10-22 13:15:52 +05:30
|
|
|
if [ -z "$INSTALLDIR" ]; then
|
|
|
|
INSTALLDIR=${DEFAULT_DIR}
|
|
|
|
fi
|
2017-02-11 05:02:02 +05:30
|
|
|
[[ -d "$INSTALLDIR" ]] || echo -e "$INSTALLDIR not found..!\n"
|
2011-10-20 21:43:38 +05:30
|
|
|
done
|
2011-07-28 12:57:39 +05:30
|
|
|
|
2010-08-18 02:52:24 +05:30
|
|
|
INSTALLDIR=${INSTALLDIR%/} # remove trailing slash
|
2011-10-20 21:43:38 +05:30
|
|
|
echo "MSC installation path: $INSTALLDIR"
|
2010-07-31 01:09:54 +05:30
|
|
|
|
2012-11-13 20:57:06 +05:30
|
|
|
DEFAULT_EDITOR='vi'
|
|
|
|
EDITOR=''
|
|
|
|
while [ -z "$EDITOR" ]
|
|
|
|
do
|
|
|
|
echo "Input command to invoke your preferred editor: [${DEFAULT_EDITOR}]"
|
|
|
|
read EDITOR
|
|
|
|
if [ -z "$EDITOR" ]; then
|
2013-08-02 19:25:06 +05:30
|
|
|
EDITOR=${DEFAULT_EDITOR}
|
2012-11-13 20:57:06 +05:30
|
|
|
fi
|
|
|
|
done
|
2013-08-02 19:25:06 +05:30
|
|
|
echo "Editor: $EDITOR"
|
2011-11-14 20:29:16 +05:30
|
|
|
|
2010-07-31 01:09:54 +05:30
|
|
|
# tools
|
2011-07-28 12:57:39 +05:30
|
|
|
echo ''
|
2017-03-16 05:13:04 +05:30
|
|
|
echo 'adapting Marc tools...'
|
2011-07-28 12:57:39 +05:30
|
|
|
theDIR=$INSTALLDIR/marc$VERSION/tools
|
2018-08-31 12:22:21 +05:30
|
|
|
for filename in 'comp_damask_mp' \
|
2013-07-24 14:11:58 +05:30
|
|
|
'comp_damask_lmp' \
|
|
|
|
'comp_damask_hmp' \
|
|
|
|
'run_damask_mp' \
|
|
|
|
'run_damask_lmp' \
|
|
|
|
'run_damask_hmp' \
|
2010-11-24 13:25:08 +05:30
|
|
|
'include_linux64'; do
|
2016-07-15 14:24:28 +05:30
|
|
|
cp $SCRIPTLOCATION/$VERSION/Marc_tools/$filename $theDIR
|
2010-08-18 02:52:24 +05:30
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g"
|
2011-07-28 12:57:39 +05:30
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g"
|
2010-07-31 01:09:54 +05:30
|
|
|
echo $filename
|
|
|
|
done
|
|
|
|
|
|
|
|
# Mentat scripts
|
2011-07-28 12:57:39 +05:30
|
|
|
echo ''
|
2017-03-16 05:13:04 +05:30
|
|
|
echo 'adapting Mentat scripts...'
|
2011-07-28 12:57:39 +05:30
|
|
|
theDIR=$INSTALLDIR/mentat$VERSION/bin
|
2010-07-31 01:09:54 +05:30
|
|
|
for filename in 'edit_window' \
|
2013-04-26 19:13:10 +05:30
|
|
|
'submit4' \
|
|
|
|
'submit5' \
|
|
|
|
'submit6' \
|
|
|
|
'kill4' \
|
|
|
|
'kill5' \
|
2018-08-31 12:22:21 +05:30
|
|
|
'kill6'; do
|
2016-07-15 14:24:28 +05:30
|
|
|
cp $SCRIPTLOCATION/$VERSION/Mentat_bin/$filename $theDIR
|
2010-08-18 02:52:24 +05:30
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g"
|
2011-07-28 12:57:39 +05:30
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g"
|
2012-11-13 20:57:06 +05:30
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%EDITOR%:${EDITOR}:g"
|
2010-07-31 01:09:54 +05:30
|
|
|
echo $filename
|
|
|
|
done
|
|
|
|
|
|
|
|
# Mentat scripts
|
2017-06-02 13:29:54 +05:30
|
|
|
echo -e '\nadapting Mentat menus...'
|
2011-07-28 12:57:39 +05:30
|
|
|
theDIR=$INSTALLDIR/mentat$VERSION/menus
|
2010-07-31 01:09:54 +05:30
|
|
|
for filename in 'job_run.ms'; do
|
2016-07-15 14:24:28 +05:30
|
|
|
cp $SCRIPTLOCATION/$VERSION/Mentat_menus/$filename $theDIR
|
2010-08-18 02:52:24 +05:30
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g"
|
2011-07-28 12:57:39 +05:30
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g"
|
2010-07-31 01:09:54 +05:30
|
|
|
echo $filename
|
|
|
|
done
|
|
|
|
|
|
|
|
# compile menus
|
2011-07-28 12:57:39 +05:30
|
|
|
echo ''
|
2017-03-16 05:13:04 +05:30
|
|
|
echo 'compiling Mentat menu binaries...'
|
|
|
|
$(which xvfb-run 2>/dev/null) $INSTALLDIR/mentat$VERSION/bin/mentat -compile $INSTALLDIR/mentat$VERSION/menus/linux64/main.msb
|
|
|
|
[[ $? != 0 ]] && echo '...failed. Try installing xvfb-run on your system.'
|
2010-07-31 01:09:54 +05:30
|
|
|
|
|
|
|
# setting access rights
|
2011-07-28 12:57:39 +05:30
|
|
|
echo ''
|
2010-07-31 01:09:54 +05:30
|
|
|
echo 'setting file access rights...'
|
2017-03-16 05:13:04 +05:30
|
|
|
for filename in marc$VERSION/tools/run_damask* \
|
|
|
|
marc$VERSION/tools/comp_damask* \
|
2018-08-31 12:22:21 +05:30
|
|
|
mentat$VERSION/bin/submit{4..6} \
|
|
|
|
mentat$VERSION/bin/kill{4..6} ; do
|
2017-03-16 05:13:04 +05:30
|
|
|
chmod 755 $INSTALLDIR/${filename}
|
|
|
|
done
|
2010-07-31 01:09:54 +05:30
|
|
|
|
2017-05-16 14:40:01 +05:30
|
|
|
#creating symlinks for run_damask_scripts
|
2016-07-15 14:24:28 +05:30
|
|
|
|
|
|
|
if [ -d "$BIN_DIR" ]; then
|
|
|
|
echo ''
|
|
|
|
echo "Do you want to create symlinks for run_damask scripts in ${BIN_DIR} [YES/no] ?"
|
|
|
|
read YESNO
|
|
|
|
if [ -z "$YESNO" ]; then
|
|
|
|
YESNO=yes
|
|
|
|
fi
|
|
|
|
case $YESNO in
|
|
|
|
y* | Y* )
|
|
|
|
echo''
|
|
|
|
echo 'creating symlinks ...'
|
|
|
|
echo''
|
|
|
|
theDIR=$INSTALLDIR/marc$VERSION/tools
|
2018-08-31 12:22:21 +05:30
|
|
|
for filename in 'run_damask_mp' \
|
2016-07-15 14:24:28 +05:30
|
|
|
'run_damask_lmp' \
|
|
|
|
'run_damask_hmp'; do
|
|
|
|
echo ${filename:4}$VERSION
|
|
|
|
[ -f $BIN_DIR/${filename:4}$VERSION ] && rm $BIN_DIR/${filename:4}$VERSION
|
|
|
|
ln -s $theDIR/$filename $BIN_DIR/${filename:4}$VERSION
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2013-08-02 19:25:06 +05:30
|
|
|
|
2017-03-16 05:13:04 +05:30
|
|
|
# precompiling user subroutine
|
|
|
|
echo ''
|
|
|
|
echo 'precompiling $VERSION HYPELA2 user subroutine...'
|
|
|
|
echo 'not yet implemented..!'
|
|
|
|
|
2017-06-02 13:28:44 +05:30
|
|
|
echo -e '\ndone.'
|