blob: 902fe857b5498c1e26292f7a8341c7c5f5c896d3 (
plain) (
blame)
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
|
#!/usr/bin/env python
#
# /fs/microsd/etc/rc.txt file downloader
#
from nsh import NSH
from sys import argv
def main():
fn = "/fs/microsd/etc/rc.txt"
if len(argv) == 1:
out_fn = fn[fn.rindex('/')+1:]
else:
out_fn = argv[1]
try:
nsh = NSH()
nsh.wait_and_open_nsh()
if nsh.file_exists(fn):
with open(out_fn, "wb") as f:
data = nsh.download_file(fn)
print("Writing buffer to file..")
f.write(data)
print("Success.")
else:
print("Cannot find {}".format(fn))
finally:
nsh.close()
if __name__ == "__main__":
main()
|