setup.sh 1.12 KB
#!/bin/bash

echo "getting source code"
mkdir -p ~/bin/
rm -rf ~/bin/.git
rm -rf ~/bin/ingest
rm -rf ~/bin/prepare
rm -rf ~/bin/ingester
git clone git@gitlab.fccn.pt:dev-b-on/sama-scripts.git ~/bin/.

ln -s ~/bin/ingester/prepare.sh ~/bin/prepare
ln -s ~/bin/ingester/ingest.sh ~/bin/ingest

ARCH=$(uname -m | sed 's/x86_//;s/i[3-6]86/32/')

if [ -f /etc/lsb-release ]; then
    . /etc/lsb-release
    OS=$DISTRIB_ID
    VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
    OS=Debian  # XXX or Ubuntu??
    VER=$(cat /etc/debian_version)
elif [ -f /etc/redhat-release ]; then
    OS=Redhat  # XXX or Centos??
    VER=$(cat /etc/redhat-release)
else
    OS=$(uname -s)
    VER=$(uname -r)
fi

echo "install poppler-utils (pdftotext)"
if [ "$OS" == "Redhat" ]; then
     yum install poppler-utils
elif [ "$OS" == "Debian" ]; then
    sudo apt-get install poppler-utils
else
    echo "unsupported distro"
    exit
fi

echo "install cpanm"
wget -O - http://cpanmin.us | perl - --self-upgrade


echo "install required libs"
cpanm Data::Dumper
cpanm XML::LibXML
cpanm XML::LibXSLT
cpanm File::Spec
cpanm JSON::Parse

echo "instalation complete"