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
|
# 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
|
- bare-apu: Linux box
|
||||||
- controlbox: from FRM2
|
- 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,
|
Please unpower the box with compute module,
|
||||||
start this script again and put power immediately."""
|
start this script again and put power immediately."""
|
||||||
|
|
||||||
|
|
||||||
def write_image(kind):
|
def write_image(kind):
|
||||||
if kind == 'eemc':
|
if kind == 'eemc':
|
||||||
print("\nmake sure microUSB 'SLAVE' is connected to this computer")
|
print("\nmake sure microUSB 'SLAVE' is connected to this computer")
|
||||||
@ -100,34 +101,38 @@ def write_image(kind):
|
|||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
proposed = find_raspi(kind)
|
proposed = find_raspi(kind)
|
||||||
if not proposed and kind == 'emmc':
|
if not proposed:
|
||||||
# we may install rpiboot here if not available
|
if kind == 'emmc':
|
||||||
# git clone --depth=1 https://github.com/raspberrypi/usbboot
|
# we may install rpiboot here if not available
|
||||||
# cd usbboot
|
# git clone --depth=1 https://github.com/raspberrypi/usbboot
|
||||||
# make
|
# cd usbboot
|
||||||
# ./rpiboot
|
# make
|
||||||
|
# ./rpiboot
|
||||||
|
|
||||||
print('not found - put rpi in bootloader mode')
|
print('not found - put rpi in bootloader mode')
|
||||||
if not rpiboot() and not rpiboot():
|
if not rpiboot() and not rpiboot():
|
||||||
print(rescue)
|
print(rescue)
|
||||||
return
|
return
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
proposed = find_raspi(kind)
|
proposed = find_raspi(kind)
|
||||||
if proposed:
|
if proposed:
|
||||||
break
|
break
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
else:
|
else:
|
||||||
list_external()
|
list_external()
|
||||||
print('can not find CM')
|
print('can not find CM')
|
||||||
return
|
return
|
||||||
list_external()
|
list_external()
|
||||||
if len(proposed) > 1:
|
if len(proposed) == 1:
|
||||||
|
dev = proposed[0]
|
||||||
|
elif len(proposed) > 1:
|
||||||
if kind == 'emmc':
|
if kind == 'emmc':
|
||||||
print('several potential devices for CM:', proposed)
|
print('several potential devices for CM:', proposed)
|
||||||
return
|
return
|
||||||
dev = input('select device to write to {" ".join(proposed)}: ')
|
dev = input('select device to write to {" ".join(proposed)}: ')
|
||||||
else:
|
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')
|
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):
|
for file in sorted(images):
|
||||||
print(file)
|
print(file)
|
||||||
|
Reference in New Issue
Block a user