From 1e7ecdf8b3193bef161498d6579a30de73555fce Mon Sep 17 00:00:00 2001
From: Thomas Schneider <thomas@fsmpi.rwth-aachen.de>
Date: Thu, 2 Mar 2023 04:19:27 +0100
Subject: [PATCH] shell: Install emacs-nox iff emacs-gtk is not installed

---
 shell/defaults/main.yml | 1 -
 shell/tasks/shell.yml   | 9 +++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/shell/defaults/main.yml b/shell/defaults/main.yml
index bf965fe..db33512 100644
--- a/shell/defaults/main.yml
+++ b/shell/defaults/main.yml
@@ -2,7 +2,6 @@
 
 shell_software:
   - bash-completion
-  - emacs-nox
   - lftp
   - mercurial
   - pwgen
diff --git a/shell/tasks/shell.yml b/shell/tasks/shell.yml
index a0f7911..12ebbb1 100644
--- a/shell/tasks/shell.yml
+++ b/shell/tasks/shell.yml
@@ -49,6 +49,15 @@
     - packages
     - shell
 
+- name: check installed software
+  package_facts:
+    manager: auto
+
+- name: install emacs-nox iff emacs-gtk is not installed
+  apt:
+    name: emacs-nox
+  when: "'emacs-gtk' not in ansible_facts.packages"
+
 - name: ensure installation of variable additional software
   apt:
     name: "{{ shell_software }}"
-- 
GitLab