summaryrefslogtreecommitdiffstats
path: root/bin/ssh-add-helper
blob: bfc2844d81380bdf75128040f7de03ad536bd7b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env perl
use strict;
use warnings;
use IO::Pty::Easy;

my $hostname = `hostname`;
open STDIN, '<', '/dev/tty';
my $pass = `pwsafe -pE ssh.$hostname`;
my $pty = IO::Pty::Easy->new;
$pty->spawn("ssh-add -t 1800 $ARGV[0]");
$pty->read;
$pty->write($pass . "\n");
while (1) {
    last if $pty->read =~ 'Identity added';
}