#!/bin/sh
#ATOM_HOME='/root/Desktop/atom7.2'
if [! -x "$ATOM_HOME" ]; then
echo "The environment variable of ATOM_HOME need to be set first."
else
if [ -x "/etc/yum.repos.d" ]; then
if [ ! -x "/etc/yum.repos.d.old" ]; then
cp -rf /etc/yum.repos.d /etc/yum.repos.d.old
fi
rm -rf /etc/yum.repos.d/*
if [ -f "$ATOM_HOME/Env/OSRepo.tar.gz" ]; then
echo "Mount the OS-yum in your linux syterm."
cd $ATOM_HOME/Env
tar -zxvf $ATOM_HOME/Env/OSRepo.tar.gz
echo -e "[OS]\nname=OS\nbaseurl=file://$ATOM_HOME/Env/OSRepo\nenabled=1\ngpgcheck=0" >> /etc/yum.repos.d/R.repo
fi
if [ -f "$ATOM_HOME/Env/RRepo.tar.gz" ]; then
echo "Mount the R-yum in your linux syterm."
cd $ATOM_HOME/Env
tar -zxvf $ATOM_HOME/Env/RRepo.tar.gz
echo -e "[R]\nname=R\nbaseurl=file://$ATOM_HOME/Env/RRepo\nenabled=1\ngpgcheck=0" >> /etc/yum.repos.d/R.repo
fi
yum clean all
yum makecache
yum -y install R
if [ -x "/etc/yum.repos.d.old" ]; then
echo "Unmount the OS-yum and R-yum from your linux syterm."
cp -rf /etc/yum.repos.d.old /etc
fi
fi
if [ -x "/usr/lib64/R" ]; then
cd $ATOM_HOME/Env
if [ -f "$ATOM_HOME/Env/Rlib.tar.gz" ]; then
tar -zxvf $ATOM_HOME/Env/Rlib.tar.gz
fi
if [ ! -x "/usr/lib64/R/library.old" ]; then
cp -rf /usr/lib64/R/library /usr/lib64/R/library.old
fi
echo "Copy the R-library in your R home."
cp -ri -n $ATOM_HOME/Env/library/* /usr/lib64/R/library/
fi
chmod 700 $ATOM_HOME/Atom
echo "ATOM for test with the functions : Explore, Learn, Act, Test."
$ATOM_HOME/Atom Explore -conf $ATOM_HOME/conf/atom_explore.json
$ATOM_HOME/Atom Learn -conf $ATOM_HOME/conf/atom_learn.json
$ATOM_HOME/Atom Act -conf $ATOM_HOME/conf/atom_act.json
$ATOM_HOME/Atom Test -conf $ATOM_HOME/conf/atom_test.json
#$ATOM_HOME/Atom Go -conf $ATOM_HOME/conf/atom_go.json
echo "ATOM INSTALL : SUCCESS."
fi