-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathmpull
executable file
·53 lines (38 loc) · 1013 Bytes
/
mpull
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
#!/usr/bin/env ruby
#
# Android Cluster Toolkit
#
# mpull - pull a path from the selected device(s)
#
# (c) 2012-2015 Joshua J. Drake (jduck)
#
bfn = __FILE__
while File.symlink?(bfn)
bfn = File.expand_path(File.readlink(bfn), File.dirname(bfn))
end
$:.unshift(File.join(File.dirname(bfn), 'lib'))
require 'devices'
load_connected()
require 'madb'
# process args
if not parse_global_options() or ARGV.length < 1
$stderr.puts "usage: mpull [-1v] -d <device names or serials separated by commas> <path to pull>"
exit(1)
end
path = ARGV.shift
#
# NOTE: this can't use multi_adb because it has a device-dependant argument
#
$devices[:connected].each { |dev|
next if not is_selected(dev)
if dev[:disabled]
puts "[!] Warning: The selected device is marked disabled. It may not be present."
end
print_col_prefix(dev)
cmd = [ 'adb', '-s', dev[:serial], 'pull' ]
cmd << path
cmd << File.join([ 'devices', dev[:name], path ])
#puts cmd
system(*cmd)
puts "" if not $one_line
}