summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-06-14 11:29:16 +0200
committerChristian Poessinger <christian@poessinger.com>2020-06-14 11:29:16 +0200
commite85ce4276c092e3d171646759ebc987a17116205 (patch)
tree0d606f1458eefe62ab44620f135994b93dc68e6b /src/conf_mode
parentde112874efc3d75f669721abcca5160306b540b7 (diff)
downloadvyos-1x-e85ce4276c092e3d171646759ebc987a17116205.tar.gz
vyos-1x-e85ce4276c092e3d171646759ebc987a17116205.zip
console: T2569: bugfix removing entire console CLI tree
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/system_console.py13
1 files changed, 10 insertions, 3 deletions
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 >/dev/tty1 2>&1')
+
+ # Reload systemd manager configuration
+ call('systemctl daemon-reload')
+
if not console:
return None