From 1b29e44930404461f5335078554993c97515a53a Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Santoro?= Date: Mon, 20 Nov 2017 00:31:00 +0100 Subject: [PATCH] Install Synergy Provide a client/server launcher to the session startup script. A state to distribute of home files have been prepared in thos goal. --- pillar/top.sls | 1 + .../init.sls => pillar/workstation/synergy.sls | 8 +++--- roles/core/home/files/dereckson/bin/start | 18 ++++++++++++++ roles/core/home/init.sls | 29 ++++++++++++++++++++++ roles/core/init.sls | 1 + roles/workstation/userland-software/desktop.sls | 1 + 6 files changed, 55 insertions(+), 3 deletions(-) copy roles/core/init.sls => pillar/workstation/synergy.sls (80%) create mode 100644 roles/core/home/files/dereckson/bin/start create mode 100644 roles/core/home/init.sls diff --git a/pillar/top.sls b/pillar/top.sls index 402b554..ae4afd1 100644 --- a/pillar/top.sls +++ b/pillar/top.sls @@ -10,3 +10,4 @@ base: '*': - core/users - workstation/atom + - workstation/synergy diff --git a/roles/core/init.sls b/pillar/workstation/synergy.sls similarity index 80% copy from roles/core/init.sls copy to pillar/workstation/synergy.sls index 8d8d34d..9c6b07a 100644 --- a/roles/core/init.sls +++ b/pillar/workstation/synergy.sls @@ -1,10 +1,12 @@ + # ------------------------------------------------------------- # Salt — Provision a small local network # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Project: Wynter -# Created: 2017-10-25 +# Created: 2017-11-19 # License: Trivial work, not eligible to copyright # ------------------------------------------------------------- -include: - - .shell +synergy_server: + id: orin + addr: 172.27.26.119 diff --git a/roles/core/home/files/dereckson/bin/start b/roles/core/home/files/dereckson/bin/start new file mode 100644 index 0000000..fcb1a2d --- /dev/null +++ b/roles/core/home/files/dereckson/bin/start @@ -0,0 +1,18 @@ +#!/bin/sh + +# ------------------------------------------------------------- +# Starting script for X sessions +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Project: Wynter +# License: Trivial work, not eligible to copyright +# ------------------------------------------------------------- + +# ------------------------------------------------------------- +# Synergy +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +{% if is_synergy_server %} +synergys --daemon --no-tray --debug NOTE --name {{ hostname }} -c {{ etc }}/synergy.conf --address :24800 +{% else %} +synergyc --daemon --no-tray --debug WARNING --name {{ hostname }} {{ synergy_server }}:24800 +{% endif %} diff --git a/roles/core/home/init.sls b/roles/core/home/init.sls new file mode 100644 index 0000000..6ee913f --- /dev/null +++ b/roles/core/home/init.sls @@ -0,0 +1,29 @@ +# ------------------------------------------------------------- +# Salt — Provision a small local network +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Project: Wynter +# Created: 2017-11-19 +# License: Trivial work, not eligible to copyright +# ------------------------------------------------------------- + +{% from "map.jinja" import dirs with context %} + +# ------------------------------------------------------------- +# Provision /home directories +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +{% for user in salt['pillar.get']("users", []) %} +{% set home = dirs.home + "/" + user %} + +{{ home }}: + file.recurse: + - source: salt://roles/core/home/files/{{ user }} + - template: jinja + - user: {{ user }} + - context: + is_synergy_server: {{ grains['id'] == pillar['synergy_server']['id'] }} + synergy_server: {{ pillar['synergy_server']['addr'] }} + hostname: {{ grains['id'] }} + etc: {{ dirs.etc }} + +{% endfor %} diff --git a/roles/core/init.sls b/roles/core/init.sls index 8d8d34d..8c777e1 100644 --- a/roles/core/init.sls +++ b/roles/core/init.sls @@ -8,3 +8,4 @@ include: - .shell + - .home diff --git a/roles/workstation/userland-software/desktop.sls b/roles/workstation/userland-software/desktop.sls index 856b896..31b3528 100644 --- a/roles/workstation/userland-software/desktop.sls +++ b/roles/workstation/userland-software/desktop.sls @@ -18,6 +18,7 @@ desktop_environment: - gnome3 - cinnamon - guake + - synergy {% if grains['os'] == 'FreeBSD' %} - xorg {% endif %} -- 2.11.4.GIT