1
0
mirror of https://github.com/Yubico/yubikey-ksm.git synced 2025-01-21 22:52:10 +01:00

start adding travis for yubikey-ksm

This commit is contained in:
Klas Lindfors 2013-11-06 14:48:17 +01:00
parent db7919ea9f
commit b868157f42
2 changed files with 55 additions and 0 deletions

10
.travis.yml Normal file
View File

@ -0,0 +1,10 @@
language: php
php:
- 5.5
- 5.4
- 5.3
env:
- DB=mysql
- DB=pgsql
script:
- ./selftest.sh

45
selftest.sh Normal file
View File

@ -0,0 +1,45 @@
#!/bin/bash
set -e
set -x
packages="help2man apache2 php5-mcrypt curl"
if [ "x$DB" = "xmysql" ]; then
dbuser=travis
packages="$packages php5-mysql"
mysql -u $dbuser -e 'create database ykksm;'
mysql -u $dbuser ykksm < ykksm-db.sql
dbrun="mysql -u $dbuser ykksm -e"
else [ "x$DB" = "xpgsql" ]; then
dbuser=postgres
packages="$packages php5-pgsql"
psql -U $dbuser -c 'create database ykksm;'
psql -U $dbuser ykksm < ykksm-db.sql
dbrun="psql -U $dbuser ykksm -c"
fi
sudo apt-get update -qq
sudo apt-get install -qq --y $packages
git submodule update --init
sudo make install symlink
sudo sh -c "echo 'include_path = "/etc/yubico/ksm:/usr/share/ykksm"' > /etc/php5/conf.d/ykksm.ini"
sudo chmod a+r /usr/share/yubikey-ksm/* /etc/yubico/ksm/*
cat > config-db.php << EOF
<?php
\$dbuser = '$dbuser';
\$dbpass = '';
\$dbname = 'ykksm';
\$dbtype = '$DB';
?>
EOF
sudo mv config-db.php /etc/yubico/ksm/
$dbrun 'insert into yubikeys (publicname,internalname,aeskey) values("idkfefrdhtru","609963eae7b5","c68c9df8cbfe7d2f994cb904046c7218");'
sudo /etc/init.d/apache2 restart
curl --silent http://localhost/wsapi/decrypt?otp=idkfefrdhtrutjduvtcjbfeuvhehdvjjlbchtlenfgku | grep -q "^OK counter=0001 low=8d40 high=0f use=00" || (echo "failed OTP"; exit 1)