From 8fcbf477a9c15e8f89b1e79d15970454a6309043 Mon Sep 17 00:00:00 2001 From: l_samenv Date: Tue, 11 Jun 2024 16:15:42 +0200 Subject: [PATCH] improve install.py after problems with linse-gas10ka - use --break-system-packages for pip - rename box - remove some unused stuff about display --- ...x1_5b265c.cfg => linse-gas10ka_5b265c.cfg} | 4 +++ install.py | 28 +++++-------------- 2 files changed, 11 insertions(+), 21 deletions(-) rename cfg/{linse-box1_5b265c.cfg => linse-gas10ka_5b265c.cfg} (83%) diff --git a/cfg/linse-box1_5b265c.cfg b/cfg/linse-gas10ka_5b265c.cfg similarity index 83% rename from cfg/linse-box1_5b265c.cfg rename to cfg/linse-gas10ka_5b265c.cfg index d5753db..72aea4a 100644 --- a/cfg/linse-box1_5b265c.cfg +++ b/cfg/linse-gas10ka_5b265c.cfg @@ -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 diff --git a/install.py b/install.py index ff1a48a..9353f24 100755 --- a/install.py +++ b/install.py @@ -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): - 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)) + 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' 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}']