diff options
Diffstat (limited to 'Tools/fileman/setrc.py')
-rwxr-xr-x | Tools/fileman/setrc.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Tools/fileman/setrc.py b/Tools/fileman/setrc.py new file mode 100755 index 000000000..13088f721 --- /dev/null +++ b/Tools/fileman/setrc.py @@ -0,0 +1,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() |