#!/usr/bin/perl -w

use strict;
use warnings;
use Expect;

my $scp = 'scp  -P 5555 -r -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ';
my $location = '/home/pforty/www/bobek.pforty.com/htdocs/share/gentoo/* root@localhost:/mnt/gentoo';
my $command = $scp.$location;
my @parameters = ();

my $exp = new Expect;
$exp->raw_pty(1);
$exp->spawn($command, @parameters)
  or die "Cannot spawn $command: $!\n";

#sleep 3;            # give it time to prepare grub
#$exp->send("\n");   # send some string there:
#sleep 3;            # give it time to prepare grub
#$exp->send("\n");   # send some string there:

$exp->expect(30, ['Password:']);
$exp->send("inttest\n");
sleep 1;
$exp->send("logout\n");

$exp->soft_close();

