aboutsummaryrefslogtreecommitdiff
path: root/Tools/fileman/setrc.py
blob: 13088f7216b320f54e0fdf8f1e0217e05fa81bcf (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
#!/usr/bin/env python
#
# /fs/microsd/etc/rc.txt file uploader
#

from nsh import NSH

from os import path
from sys import argv, exit

def main():
	if len(argv) != 2:
		print("usage: setrc <path to rc.txt>")
		exit(1)

	rc_path = argv[1]
	if not path.isfile(rc_path):
		print("cannot find file {}".format(rc_path))
		exit(2)

	try:
		nsh = NSH()
		nsh.wait_and_open_nsh()
		if nsh.upload_file("/fs/microsd/etc/rc.txt", rc_path):
			print("Success.")
	finally:
		nsh.close()

if __name__ == "__main__":
	main()