Instead of upload requiring root to upload to /dev/sdb we chown in in the source script
This commit is contained in:
@@ -84,16 +84,11 @@ def upload_bload(filename):
|
||||
print("Failed to open serial port")
|
||||
|
||||
def upload_sd(filename):
|
||||
if os.geteuid() == 0:
|
||||
print("Running as root")
|
||||
file_in = open(filename, "rb")
|
||||
file_out = open("/dev/sdb", "wb")
|
||||
# @todo This does require /dev/sdb to be accessible without root
|
||||
file_in = open(filename, "rb")
|
||||
file_out = open("/dev/sdb", "wb")
|
||||
|
||||
file_out.write(file_in.read())
|
||||
else:
|
||||
print("Reqeusting root permission")
|
||||
subprocess.call(["sudo", "python3", *sys.argv])
|
||||
sys.exit()
|
||||
file_out.write(file_in.read())
|
||||
|
||||
|
||||
# @todo For now we just wrap the existing mojo.py tool
|
||||
|
||||
Reference in New Issue
Block a user