#!/bin/bash
if [ $1 ]
then 
IFS=',' read -a hosts <<< $1
else 
hosts=(lunapark-public-beta.haze.yandex.net)
fi

git pull
debuild -I -uc -us
for host in $hosts
do
echo "DEPLOYING TO" $host
scp -o NumberOfPasswordPrompts=0 -o StrictHostKeyChecking=no -o PasswordAuthentication=no ../`cat debian/files | cut -d' ' -f1` $host:/tmp
ssh -o NumberOfPasswordPrompts=0 -o StrictHostKeyChecking=no -o PasswordAuthentication=no $host "sudo dpkg -i --force-depends /tmp/`cat debian/files | cut -d' ' -f1`"
done
date
