add comments
This commit is contained in:
8
flash.py
Executable file → Normal file
8
flash.py
Executable file → Normal file
@@ -44,17 +44,25 @@ def flash(dev):
|
|||||||
try:
|
try:
|
||||||
flash_cmd = ["/bin/dd", f"if={IMAGE}", f"of={dev}"]
|
flash_cmd = ["/bin/dd", f"if={IMAGE}", f"of={dev}"]
|
||||||
|
|
||||||
|
print("flashing")
|
||||||
subprocess.run(flash_cmd)
|
subprocess.run(flash_cmd)
|
||||||
|
print("flashed")
|
||||||
|
|
||||||
with tempfile.TemporaryDirectory() as tempdir:
|
with tempfile.TemporaryDirectory() as tempdir:
|
||||||
mount_cmd = ["mount",f"{dev}2", tempdir]
|
mount_cmd = ["mount",f"{dev}2", tempdir]
|
||||||
umount_cmd = ["umount", tempdir]
|
umount_cmd = ["umount", tempdir]
|
||||||
|
|
||||||
|
print("mounting")
|
||||||
subprocess.run(mount_cmd)
|
subprocess.run(mount_cmd)
|
||||||
|
print(f"changing dir to {tempdir}")
|
||||||
os.chdir(tempdir)
|
os.chdir(tempdir)
|
||||||
|
print("making ssh dir")
|
||||||
os.mkdir("ssh")
|
os.mkdir("ssh")
|
||||||
|
print(f"changing dir to {PWD}")
|
||||||
os.chdir(PWD)
|
os.chdir(PWD)
|
||||||
|
print(f"copying wpa_supplicant to {tempdir}")
|
||||||
copyfile("wpa_supplicant.conf", tempdir)
|
copyfile("wpa_supplicant.conf", tempdir)
|
||||||
|
print("unmounting")
|
||||||
subprocess.run(umount_cmd)
|
subprocess.run(umount_cmd)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user