setup.sh 1.08 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/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 libxml2 libxml2-devel libxslt libxslt-devel gdbm-devel
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"
cpan YAML
cpan Data::Dumper
cpan XML::LibXML
cpan XML::LibXSLT
cpan File::Spec
cpan JSON::Parse

echo "instalation complete"