do not consider network installs when not specified

This commit is contained in:
2025-04-09 09:45:12 +02:00
parent e48e1302c0
commit 2dfc71001a
2 changed files with 47 additions and 46 deletions

View File

@ -15,6 +15,7 @@ import filecmp
import re import re
import types import types
import socket import socket
import tempfile
from pathlib import Path from pathlib import Path
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from ipaddress import IPv4Interface from ipaddress import IPv4Interface
@ -520,9 +521,9 @@ def handle_config():
box.typ = 'bare-apu' box.typ = 'bare-apu'
elif box.typ == 'cm4': elif box.typ == 'cm4':
box.typ = 'dual-eth-rpi' box.typ = 'dual-eth-rpi'
print('This is a cm4, so guess its a dual-eth-rpi - please check type in cfg file') print('This is a cm4, so guess its a dual-eth-rpi - please check type in created cfg file')
elif box.typ == 'cm3': elif box.typ == 'cm3':
print('This is a cm3 so guess its a ionopimax - please check type in cfg file') print('This is a cm3 so guess its a ionopimax - please check type in created cfg file')
box.typ = 'ionopimax' box.typ = 'ionopimax'
template = TEMPLATES.get(box.typ) template = TEMPLATES.get(box.typ)
if template is None: if template is None:
@ -542,10 +543,9 @@ def handle_config():
config = box.read_config() config = box.read_config()
cfgfile = box.cfgfile cfgfile = box.cfgfile
if box.hostname_changed or box.hostname != newhostname: if box.hostname_changed or box.hostname != newhostname:
print('changed', box.hostname, newhostname)
box.hostname_changed = True box.hostname_changed = True
if cfgfile: if cfgfile:
newhostname = cfgfile.stem.rpartition('_')[0] newhostname = cfgfile.stem.split('_')[0]
if doit: if doit:
print('bash sethostname.sh') print('bash sethostname.sh')
unix_cmd('bash', f'{TOOLS}/sethostname.sh') unix_cmd('bash', f'{TOOLS}/sethostname.sh')
@ -561,6 +561,7 @@ def handle_config():
ifname = '' ifname = ''
try: try:
netcfg = config.get('NETWORK', {}) netcfg = config.get('NETWORK', {})
if netcfg: # when not network is specified, do not handle network at all
for name in netcfg: for name in netcfg:
if name not in box.network_interfaces: if name not in box.network_interfaces:
print(f'{name} is not a valid network interface name') print(f'{name} is not a valid network interface name')

View File

@ -115,7 +115,7 @@ class BoxInfo:
break break
if not cfgfiles: if not cfgfiles:
cfgfiles = list(self.CFGDIR.glob(f'*_{self.id:06x}.cfg*')) cfgfiles = list(self.CFGDIR.glob(f'*_{self.id:06x}.cfg*'))
self.oldcfg = True self.oldcfg = bool(cfgfiles)
if len(cfgfiles) > 1: if len(cfgfiles) > 1:
raise AmbiguousConfigFile('ambiguous cfgfile: %r' % cfgfiles) raise AmbiguousConfigFile('ambiguous cfgfile: %r' % cfgfiles)
if section and not cfgfiles: if section and not cfgfiles: