fix checking of box types
+ a bug (type)
This commit is contained in:
19
install.py
19
install.py
@ -46,6 +46,7 @@ if serial is None:
|
|||||||
|
|
||||||
|
|
||||||
TOOLS = BoxInfo.TOOLS
|
TOOLS = BoxInfo.TOOLS
|
||||||
|
BOX_TYPES = {'ionopi', 'ionopimax', 'controlbox', 'bare-apu', 'dual-eth-rpi'}
|
||||||
|
|
||||||
more_info = False
|
more_info = False
|
||||||
|
|
||||||
@ -158,7 +159,7 @@ box = BoxInfo()
|
|||||||
box.hostname_changed = False
|
box.hostname_changed = False
|
||||||
dhcp_server_cfg = []
|
dhcp_server_cfg = []
|
||||||
|
|
||||||
TO_SYSTEM = TOOLS / 'to_system', TOOLS / f'{box.typ}_system']
|
TO_SYSTEM = TOOLS / 'to_system', TOOLS / f'{box.typ}_system'
|
||||||
|
|
||||||
|
|
||||||
def do_cmd(*command):
|
def do_cmd(*command):
|
||||||
@ -464,15 +465,15 @@ class Show(Walker):
|
|||||||
|
|
||||||
class Do(Walker):
|
class Do(Walker):
|
||||||
def newer(self, files):
|
def newer(self, files):
|
||||||
unix_cmd('cp', *(str(srcdir / f) for f in files), str(dstdir),
|
unix_cmd('cp', *(str(self.dirpath / f) for f in files), str(self.syspath),
|
||||||
sudo=not dstdir.is_relative_to('/home/l_samenv'))
|
sudo=not self.syspath.is_relative_to(Path.home()))
|
||||||
|
|
||||||
older = newer
|
older = newer
|
||||||
|
|
||||||
missing = newer
|
missing = newer
|
||||||
|
|
||||||
def delete(self, files):
|
def delete(self, files):
|
||||||
unix_cmd('rm', '-f', *(str(srcdir / f) for f in files))
|
unix_cmd('rm', '-f', *(str(self.syspath / f) for f in files))
|
||||||
|
|
||||||
|
|
||||||
def handle_config():
|
def handle_config():
|
||||||
@ -485,14 +486,12 @@ def handle_config():
|
|||||||
newhostname = box.hostname
|
newhostname = box.hostname
|
||||||
if cfgfile:
|
if cfgfile:
|
||||||
if box.hwtype != 'apu':
|
if box.hwtype != 'apu':
|
||||||
try:
|
|
||||||
typ = config.get('BOX', {}).get('type')
|
typ = config.get('BOX', {}).get('type')
|
||||||
if typ:
|
if typ:
|
||||||
|
if typ not in BOX_TYPES:
|
||||||
|
raise ValueError(f'unknown type={typ} defined in BOX section')
|
||||||
box.typ = typ
|
box.typ = typ
|
||||||
except ValueError:
|
elif box.typ == 'cm4':
|
||||||
pass
|
|
||||||
else:
|
|
||||||
if box.typ == 'cm4':
|
|
||||||
print('WARNING: missing type in BOX section')
|
print('WARNING: missing type in BOX section')
|
||||||
print('This is a cm4 so guess its a dual-eth-rpi')
|
print('This is a cm4 so guess its a dual-eth-rpi')
|
||||||
box.typ = 'dual-eth-rpi'
|
box.typ = 'dual-eth-rpi'
|
||||||
@ -500,8 +499,6 @@ def handle_config():
|
|||||||
print('WARNING: missing type in BOX section')
|
print('WARNING: missing type in BOX section')
|
||||||
print('This is a cm3 so guess its a ionopimax')
|
print('This is a cm3 so guess its a ionopimax')
|
||||||
box.typ = 'ionopimax'
|
box.typ = 'ionopimax'
|
||||||
else:
|
|
||||||
raise ValueError(f'unknown type={typ} defined in BOX section')
|
|
||||||
else:
|
else:
|
||||||
if box.typ == 'apu':
|
if box.typ == 'apu':
|
||||||
# determine if display is present
|
# determine if display is present
|
||||||
|
Reference in New Issue
Block a user