From 0601acd3037d4466882c45c392e4c82670b1b364 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Sat, 11 Jul 2020 17:22:27 +0100 Subject: [PATCH] Use full path in service file --- roles/home-gui/tasks/emacs.yml | 4 +++- roles/home-gui/{files => templates}/emacs.service | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) rename roles/home-gui/{files => templates}/emacs.service (83%) diff --git a/roles/home-gui/tasks/emacs.yml b/roles/home-gui/tasks/emacs.yml index fa95aed..11c1b84 100644 --- a/roles/home-gui/tasks/emacs.yml +++ b/roles/home-gui/tasks/emacs.yml @@ -10,9 +10,11 @@ repo: https://code.acperkins.com/acp/emacs.d.git dest: "{{ ansible_env.HOME }}/.emacs.d" - name: Create Emacs user service (Linux) - copy: + template: src: emacs.service dest: "{{ ansible_env.HOME }}/.config/systemd/user/emacs.service" + vars: + prefix: "{{ '/usr' if ansible_system == 'Linux' else '/usr/pkg' if ansible_system == 'NetBSD' else '/usr/local' }}" when: ansible_system == 'Linux' and emacs_binary.stat.exists == True - name: Add Emacs server to autostart (FreeBSD) copy: diff --git a/roles/home-gui/files/emacs.service b/roles/home-gui/templates/emacs.service similarity index 83% rename from roles/home-gui/files/emacs.service rename to roles/home-gui/templates/emacs.service index b29177b..de614fd 100644 --- a/roles/home-gui/files/emacs.service +++ b/roles/home-gui/templates/emacs.service @@ -8,8 +8,8 @@ Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ [Service] Type=simple -ExecStart=emacs --fg-daemon -ExecStop=emacsclient --eval "(kill-emacs)" +ExecStart={{ prefix }}/emacs --fg-daemon +ExecStop={{ prefix }}/emacsclient --eval "(kill-emacs)" Environment=SSH_AUTH_SOCK=%t/keyring/ssh Restart=on-failure