Instead of upload requiring root to upload to /dev/sdb we chown in in the source script
This commit is contained in:
parent
cb7a703564
commit
f22f74e3da
|
@ -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
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# This order makes it so we can use deactive to also deactive the other additions to the path
|
||||
sudo chown tim:tim /dev/sdb
|
||||
source $(dirname $(readlink -f $0))/env/bin/activate
|
||||
PATH=$(dirname $(readlink -f $0))/arm-none-eabi/bin:$(dirname $(readlink -f $0))/microblazeel-xilinx-elf/bin:$(dirname $(readlink -f $0))/bin:/opt/Xilinx/14.7/ISE_DS/EDK/bin/lin64:$PATH
|
||||
|
|
Loading…
Reference in New Issue
Block a user