forked from chenkaie/Tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload_pkg
executable file
·37 lines (32 loc) · 908 Bytes
/
upload_pkg
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
#!/usr/bin/perl -w
use Net::FTP;
use Env qw(PRODUCTDIR PRODUCTVER LANGUAGE);
$target = shift(@ARGV);
if (!$target)
{
print "Usage: update_pkg host-ip \n";
exit 1;
}
if (!$PRODUCTDIR)
{
print "Please source environment file first!\n";
exit 1;
}
print "Upload firmware to ", $target, "\n";
$ftp = Net::FTP->new($target, Debug => 1)
or die "Cannot connect to $target: $@";
$ftp->login("root", "")
or die "Cannot login ", $ftp->message;
$ftp->binary();
while (! $ftp->cwd("/mnt/ramdisk/"))
{
$ftp->mkdir("/mnt/ramdisk/", 1);
}
$ftp->put("$PRODUCTDIR/release/package/$PRODUCTVER-$LANGUAGE/$PRODUCTVER.flash.pkg", "flash.pkg")
or die "put failed ", $ftp->message;
#$ftp->put("$PRODUCTDIR/images/$PRODUCTVER.flash.pkg")
# or die "put failed ", $ftp->message;
$ftp->quit;
print "Starting to test if Boa is up ", $target, "\n";
print `BoaStatus $target`;
exit 0;