Skip to content

Commit

Permalink
Merge pull request #2 from dengelke/feature/preinstall-script
Browse files Browse the repository at this point in the history
Feature/preinstall script
  • Loading branch information
dengelke committed Oct 17, 2017
2 parents 3086253 + becc5db commit a6d11af
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 29 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
@@ -1,13 +1,10 @@
sudo: required
language: node_js
node_js:
- "0.10"
- "0.12"
- "4"
- "6"
- "8"
before_install:
- chmod +x ./travis/travis-init.sh
- ./travis/travis-init.sh
- sudo apt-get install -y libyaz5-dev
after_success:
- npm run coveralls
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -13,6 +13,7 @@
"cover": "istanbul cover ./node_modules/mocha/bin/_mocha",
"coveralls": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
"install": "node-gyp rebuild",
"preinstall": "./preinstall.sh",
"test": "node ./node_modules/mocha/bin/mocha test"
},
"repository": {
Expand Down
30 changes: 30 additions & 0 deletions preinstall.sh
@@ -0,0 +1,30 @@
#!/bin/bash
#
# init IndexData ubuntu deb repository

sources_list_d=/etc/apt/sources.list.d
indexdata_list=indexdata.list
apt_key=http://ftp.indexdata.dk/debian/indexdata.asc
deb_url=http://ftp.indexdata.dk

set -e

init_apt() {
if [[ "$OSTYPE" == "linux-gnu" ]]; then
file="$sources_list_d/$indexdata_list"
os=ubuntu

if [ ! -e $file ]; then
codename=$(lsb_release -c -s)
wget -O- $apt_key | sudo apt-key add -
sudo sh -c "echo deb $deb_url/${os} ${codename} main > $file.tmp"
sudo mv -f $file.tmp $file
sudo apt-get update -qq
sudo apt-get install -y libyaz5-dev
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install yaz
fi
}

init_apt
25 changes: 0 additions & 25 deletions travis/travis-init.sh

This file was deleted.

0 comments on commit a6d11af

Please sign in to comment.