#!/usr/bin/env bash
# sudo -E add-apt-repository ppa:ondrej/mysql-5.7 -y
sudo apt-get update
sudo apt-get install koha-deps koha-perldeps python-mysqldb gettext -y
locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales
sudo update-rc.d apache2 enable

cd /tmp

wget http://launchpadlibrarian.net/176644697/libexporter-tiny-perl_0.038-2_all.deb
sudo dpkg -i libexporter-tiny-perl_0.038-2_all.deb
wget http://launchpadlibrarian.net/197774432/libtype-tiny-perl_1.000005-1_all.deb
sudo dpkg -i libtype-tiny-perl_1.000005-1_all.deb
sudo dpkg -i liblog-any-adapter-perl_0.11-2_all.deb
sudo dpkg -i liblog-any-perl_1.03-1_all.deb
sudo apt-get install libjson-maybexs-perl
sudo apt-get install -f
sudo dpkg -i libsearch-elasticsearch-perl_1.19-1_all.deb
sudo dpkg -i libcatmandu-store-elasticsearch-perl_0.0304-1_all.deb

cd /vagrant
./koha_perl_deps.pl -m -u

cpanm HTTPD::Bench::ApacheBench --sudo
cpanm Readonly::XS --sudo
cpanm Test::DBIx::Class --sudo
cpanm WWW::YouTube::Download --sudo
cpanm Exception::Class --sudo
cpanm Sereal::Decoder --sudo
cpanm Sereal::Encoder --sudo
cpanm Test::WWW::Mechanize --sudo
cpanm MARC::Crosswalk::DublinCore --sudo
cpanm Test::DBIx::Class --sudo

cpanm Archive::Extract --sudo
cpanm Readonly::XS --sudo
cpanm Business::ISBN --sudo


#cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)

cat /vagrant/provisioning/mysql.sql | mysql -u root -proot 

./koha_perl_deps.pl -m -u
