#!/bin/sh

# Install the greeter in a live Tails with ssh access to root
# on ip given as 1st argument

set -x
set -e

IP=$1
VERSION=$(dpkg-parsechangelog -SVersion)

if [ "$2" != "nobuild" ] ; then
    gbp buildpackage --git-ignore-branch --git-ignore-new
fi
scp ../tails-greeter_${VERSION}_all.deb root@${IP}:~
ssh root@${IP} "dpkg -i tails-greeter_${VERSION}_all.deb ;
    sed -i 's/INFO/DEBUG/g' /usr/share/tails-greeter/tails-logging.conf ;
    service gdm stop ;
    killall -u Debian-gdm -9 ;
    service gdm start"
