rpit/write_to: quit when no proposed disk is available
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
# Installation tools for APUs and Raspberry Pi boxes
|
||||
|
||||
Supports teh following boxes used at LIN sample environment:
|
||||
Supports the following boxes used at LIN sample environment:
|
||||
|
||||
- bare-apu: Linux box
|
||||
- controlbox: from FRM2
|
||||
|
47
rpi/write_to
47
rpi/write_to
@ -92,6 +92,7 @@ Example on Markus Mac:
|
||||
Please unpower the box with compute module,
|
||||
start this script again and put power immediately."""
|
||||
|
||||
|
||||
def write_image(kind):
|
||||
if kind == 'eemc':
|
||||
print("\nmake sure microUSB 'SLAVE' is connected to this computer")
|
||||
@ -100,34 +101,38 @@ def write_image(kind):
|
||||
else:
|
||||
pass
|
||||
proposed = find_raspi(kind)
|
||||
if not proposed and kind == 'emmc':
|
||||
# we may install rpiboot here if not available
|
||||
# git clone --depth=1 https://github.com/raspberrypi/usbboot
|
||||
# cd usbboot
|
||||
# make
|
||||
# ./rpiboot
|
||||
if not proposed:
|
||||
if kind == 'emmc':
|
||||
# we may install rpiboot here if not available
|
||||
# git clone --depth=1 https://github.com/raspberrypi/usbboot
|
||||
# cd usbboot
|
||||
# make
|
||||
# ./rpiboot
|
||||
|
||||
print('not found - put rpi in bootloader mode')
|
||||
if not rpiboot() and not rpiboot():
|
||||
print(rescue)
|
||||
return
|
||||
for _ in range(10):
|
||||
proposed = find_raspi(kind)
|
||||
if proposed:
|
||||
break
|
||||
time.sleep(0.1)
|
||||
else:
|
||||
list_external()
|
||||
print('can not find CM')
|
||||
return
|
||||
print('not found - put rpi in bootloader mode')
|
||||
if not rpiboot() and not rpiboot():
|
||||
print(rescue)
|
||||
return
|
||||
for _ in range(10):
|
||||
proposed = find_raspi(kind)
|
||||
if proposed:
|
||||
break
|
||||
time.sleep(0.1)
|
||||
else:
|
||||
list_external()
|
||||
print('can not find CM')
|
||||
return
|
||||
list_external()
|
||||
if len(proposed) > 1:
|
||||
if len(proposed) == 1:
|
||||
dev = proposed[0]
|
||||
elif len(proposed) > 1:
|
||||
if kind == 'emmc':
|
||||
print('several potential devices for CM:', proposed)
|
||||
return
|
||||
dev = input('select device to write to {" ".join(proposed)}: ')
|
||||
else:
|
||||
dev = proposed[0]
|
||||
print('none of above disks seems to be the sd card')
|
||||
return
|
||||
images = check_output(['sudo', '-u', 'zolliker', 'ssh', IMAGES_HOST, f'cd {IMAGES_DIR} ; ls {IMAGES_PAT}']).decode('latin-1').split('\n')
|
||||
for file in sorted(images):
|
||||
print(file)
|
||||
|
Reference in New Issue
Block a user