pmb.install._install: check sdcard exist (extra sanity check) (!1894)
This commit is contained in:
parent
00dc54a6c7
commit
350d384492
|
@ -362,6 +362,8 @@ def embed_firmware(args):
|
||||||
|
|
||||||
def sanity_check_sdcard(device):
|
def sanity_check_sdcard(device):
|
||||||
device_name = os.path.basename(device)
|
device_name = os.path.basename(device)
|
||||||
|
if not os.path.exists(device):
|
||||||
|
raise RuntimeError("{} doesn't exist, is the sdcard plugged?".format(device))
|
||||||
if os.path.isdir('/sys/class/block/{}'.format(device_name)):
|
if os.path.isdir('/sys/class/block/{}'.format(device_name)):
|
||||||
with open('/sys/class/block/{}/ro'.format(device_name), 'r') as handle:
|
with open('/sys/class/block/{}/ro'.format(device_name), 'r') as handle:
|
||||||
ro = handle.read()
|
ro = handle.read()
|
||||||
|
|
Loading…
Reference in New Issue