#!/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=$(/bin/grep "__version__ = " setup.py | \
          sed -E "s/^.*__version__ = '(.*)'/\1/g")

gbp buildpackage --git-ignore-branch --git-ignore-new
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"
