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
|
||||
BOX_TYPES = {'ionopi', 'ionopimax', 'controlbox', 'bare-apu', 'dual-eth-rpi'}
|
||||
|
||||
more_info = False
|
||||
|
||||
@ -158,7 +159,7 @@ box = BoxInfo()
|
||||
box.hostname_changed = False
|
||||
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):
|
||||
@ -464,15 +465,15 @@ class Show(Walker):
|
||||
|
||||
class Do(Walker):
|
||||
def newer(self, files):
|
||||
unix_cmd('cp', *(str(srcdir / f) for f in files), str(dstdir),
|
||||
sudo=not dstdir.is_relative_to('/home/l_samenv'))
|
||||
unix_cmd('cp', *(str(self.dirpath / f) for f in files), str(self.syspath),
|
||||
sudo=not self.syspath.is_relative_to(Path.home()))
|
||||
|
||||
older = newer
|
||||
|
||||
missing = newer
|
||||
|
||||
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():
|
||||
@ -485,14 +486,12 @@ def handle_config():
|
||||
newhostname = box.hostname
|
||||
if cfgfile:
|
||||
if box.hwtype != 'apu':
|
||||
try:
|
||||
typ = config.get('BOX', {}).get('type')
|
||||
if typ:
|
||||
if typ not in BOX_TYPES:
|
||||
raise ValueError(f'unknown type={typ} defined in BOX section')
|
||||
box.typ = typ
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
if box.typ == 'cm4':
|
||||
elif box.typ == 'cm4':
|
||||
print('WARNING: missing type in BOX section')
|
||||
print('This is a cm4 so guess its a dual-eth-rpi')
|
||||
box.typ = 'dual-eth-rpi'
|
||||
@ -500,8 +499,6 @@ def handle_config():
|
||||
print('WARNING: missing type in BOX section')
|
||||
print('This is a cm3 so guess its a ionopimax')
|
||||
box.typ = 'ionopimax'
|
||||
else:
|
||||
raise ValueError(f'unknown type={typ} defined in BOX section')
|
||||
else:
|
||||
if box.typ == 'apu':
|
||||
# determine if display is present
|
||||
|
Reference in New Issue
Block a user