]> git.stg.codes - stg.git/blob - projects/make_tarball/get_from_cvs
Merge branch 'stg-2.409-radius'
[stg.git] / projects / make_tarball / get_from_cvs
1 #!/usr/bin/expect
2
3 # login_cvs host password
4
5 set user    [lindex $argv 0]
6 set pass    [lindex $argv 1]
7 set host    [lindex $argv 2]
8 set cvsroot [lindex $argv 3]
9 set module  [lindex $argv 4]
10 set dir     [lindex $argv 5]
11
12 set timeout 30
13
14 send_user "checkout module $module";
15
16 spawn ssh $user@$host
17 expect {
18     "(yes/no)? " { 
19         send  "yes\r"
20         send_user "Key accepted";
21         }
22     "assword:" {
23         close
24         send_user "Key accepting dont needed";
25         }
26     }
27     
28 spawn cvs -d :ext:$user@$host:$cvsroot co -N -d $dir $module 
29 expect {
30     "assword:" {
31         send "$pass\r"
32         expect {
33             "assword:" { 
34                 send_user "<h3><font color=red>cvs checkout $module failed. Incorrect password</font></h3>";
35                 exit 1
36                 }
37             "aborted" {
38                  send_user "<h3><font color=red>cvs checkout $module failed.</font></h3>";
39                  exit 1
40                  }
41             expect eof {
42             if {[lindex [wait] 3]} {
43                 send_user "<h3><font color=red>cvs checkout $module failed.</font></h3>"
44                 exit 1
45                 }
46                 }
47             }
48         }
49         
50      "aborted" {
51          send_user "<h3><font color=red>cvs checkout $module failed.</font></h3>";
52          exit 1
53          }
54     }
55   
56
57
58