From e85ce4276c092e3d171646759ebc987a17116205 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 14 Jun 2020 11:29:16 +0200 Subject: console: T2569: bugfix removing entire console CLI tree --- src/conf_mode/system_console.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/conf_mode/system_console.py') diff --git a/src/conf_mode/system_console.py b/src/conf_mode/system_console.py index 0831232fb..034cbee63 100755 --- a/src/conf_mode/system_console.py +++ b/src/conf_mode/system_console.py @@ -74,12 +74,15 @@ def generate(console): call(f'systemctl stop {basename}') os.unlink(os.path.join(root, basename)) + if not console: + return None + for device in console['device'].keys(): config_file = base_dir + f'/serial-getty@{device}.service' - render(config_file, 'getty/serial-getty.service.tmpl', console['device'][device]) + getty_wants_symlink = base_dir + f'/getty.target.wants/serial-getty@{device}.service' - # Reload systemd manager configuration - call('systemctl daemon-reload') + render(config_file, 'getty/serial-getty.service.tmpl', console['device'][device]) + os.symlink(config_file, getty_wants_symlink) # GRUB # For existing serial line change speed (if necessary) @@ -107,6 +110,10 @@ def generate(console): def apply(console): # reset screen blanking call('/usr/bin/setterm -blank 0 -powersave off -powerdown 0 -term linux /dev/tty1 2>&1') + + # Reload systemd manager configuration + call('systemctl daemon-reload') + if not console: return None -- cgit v1.2.3