improve install.py after problems with linse-gas10ka

- use --break-system-packages for pip
- rename box
- remove some unused stuff about display
This commit is contained in:
2024-06-11 16:15:42 +02:00
parent b2872db6e3
commit 8fcbf477a9
2 changed files with 11 additions and 21 deletions

View File

@ -11,3 +11,7 @@ eth3=192.168.3.3
[DISPLAY]
; please refer to README.md for help
startup_text=startup...|HOST|ADDR
[FRAPPY]
cfg = kapillarheizung
port= 5010

View File

@ -206,7 +206,7 @@ def pip():
pipcmd = 'pip3 install -r %s' % tmpname
else:
tmpname = join('/home', user, 'pip_requirements.tmp')
pipcmd = 'sudo --user %s pip3 install --user -r %s' % (user, tmpname)
pipcmd = 'sudo --user %s pip3 install --user --break-system-packages -r %s' % (user, tmpname)
filename = tmpname.replace('.tmp', '.txt')
content = ''.join('# --- for %s ---\n%s\n' % kv for kv in requirements.items())
if write_when_new(filename, content, True):
@ -533,25 +533,11 @@ def handle_config():
os.system('apt-get install isc-dhcp-server')
exit()
elif doit:
check_service('isc-dhcp-server', False)
content = []
dirty = False
for section, section_dict in config.items():
# if COMMENT not in section_dict:
# dirty = True
# content.append('[%s]' % section)
# content.append(COMMENT)
if section == 'DISPLAY':
if display_update(section_dict):
unix_cmd('systemctl stop isc-dhcp-server')
unix_cmd('systemctl disable isc-dhcp-server')
displaycfg = config.get('DISPLAY')
if displaycfg and display_update(displaycfg):
to_start['display'] = 'restart'
# for key, value in section_dict.items():
# content.append('%s=%s' % (key, value))
# content.append('')
if dirty:
print(cfgfile)
print('\n'.join(content))
#with open(cfgfile, 'w') as f:
# f.write('\n'.join(content))
except Exception as e:
print('ERROR: can not handle %s %s: %r' % (box.hostname, ifname, e))
raise
@ -597,7 +583,7 @@ def handle_config():
print('interface name system has to be changed from enp*s0 to eth*')
if replace_in_file('/etc/default/grub',
r'GRUB_CMDLINE_LINUX_DEFAULT="quiet(.*)"',
' net.ifnames=0"'):
' net.ifnames=0'):
do_cmd('update-grub')
result = [f'config file:\n {cfgfile}']