-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoPushRpm
executable file
·63 lines (55 loc) · 1.55 KB
/
autoPushRpm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/perl
#------------------------------------------------------------------------------
#
# MyRPM - Rpm Utilities
# Copyright (c) Jean-Marie RENOUARD 2014 - LightPath
# Contact : Jean-Marie Renouard <jmrenouard at gmail.com>
#
# This program is open source, licensed under the Artistic Licence v2.0.
#
# Artistic Licence 2.0
# Everyone is permitted to copy and distribute verbatim copies of
# this license document, but changing it is not allowed.
#
#------------------------------------------------------------------------------
use strict;
use Expect;
my $timeout=60;
my $user=shift;
my $userPass=shift;
my $channelPass=shift;
my $command="pushRpm ". join " ", @ARGV;
print " => $command\n";
my $exp = Expect->spawn($command) or die "Cannot spawn $command: $!\n";
$exp->raw_pty(1);
#exp->debug(2);
SAISIE:
$exp->expect($timeout,
[ 'Entrer DEFAULT_USER:' => sub {
# print "\t\t*DEMANDE USER....: $user send\n";
$exp->send("$user\n");
goto SAISIE;
}
],
[ 'USING .+$' => sub {
#print "\t\tUSER OK\n";
goto SAISIE; } ],
[ 'SIGNATURE de .+$' => sub {
#print "\t\tDEMANDE SIGNATURE OK\n";
goto SAISIE; }
],
[ 'Enter pass phrase:\s*$' => sub {
$exp->send("$channelPass\n");
goto SAISIE;
}
],
[ 'Red Hat Network password:' => sub {
$exp->send("$userPass\n");
goto SAISIE;
}
],
[ '.+\r\n$' => sub {
# print "\t\tVOID LINE\n";
goto SAISIE; } ],
);
$exp->soft_close();