Instead of upload requiring root to upload to /dev/sdb we chown in in the source script

This commit is contained in:
Dreaded_X 2020-09-21 21:59:05 +02:00
parent cb7a703564
commit f22f74e3da
2 changed files with 5 additions and 9 deletions

View File

@ -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")
# @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()
# @todo For now we just wrap the existing mojo.py tool

View File

@ -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