From 373f44e6aa539b5de25284dfd9a280312027a22e Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Fri, 28 Jul 2017 15:04:36 +0200 Subject: [PATCH 1/2] Add lirc socket as option for kodi so any kodi package can be used --- Manual.org | 2 +- roles/kodi/templates/kodi.service.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Manual.org b/Manual.org index 0353973..893282b 100644 --- a/Manual.org +++ b/Manual.org @@ -3205,7 +3205,7 @@ Description=Start kodi in user session Type=simple PassEnvironment=DISPLAY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS ExecStartPre=-/usr/bin/set-kodi-display -ExecStart=/usr/bin/kodi +ExecStart=/usr/bin/kodi -l /run/lirc/lircd ExecStop=/bin/bash -c "/usr/bin/kodi-send --action=QUIT; while /usr/bin/pgrep kodi; do sleep 1; done; sleep 1" TimeoutStopSec=10 SuccessExitStatus=0 127 diff --git a/roles/kodi/templates/kodi.service.j2 b/roles/kodi/templates/kodi.service.j2 index 6549c46..c0630cc 100644 --- a/roles/kodi/templates/kodi.service.j2 +++ b/roles/kodi/templates/kodi.service.j2 @@ -5,7 +5,7 @@ Description=Start kodi in user session Type=simple PassEnvironment=DISPLAY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS ExecStartPre=-/usr/bin/set-kodi-display -ExecStart=/usr/bin/kodi +ExecStart=/usr/bin/kodi -l /run/lirc/lircd ExecStop=/bin/bash -c "/usr/bin/kodi-send --action=QUIT; while /usr/bin/pgrep kodi; do sleep 1; done; sleep 1" TimeoutStopSec=10 SuccessExitStatus=0 127 From 0f9caa66050f6d7217f2722be6f31bc963c1c447 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Fri, 28 Jul 2017 15:07:32 +0200 Subject: [PATCH 2/2] add some empty lines --- Manual.org | 1 + group_vars/all | 7 +++++++ handlers/main.yml | 1 + install-yavdr.sh | 1 + library/hardware_facts.py | 1 + library/satip_facts.py | 1 + library/xrandr_facts.py | 1 + roles/samba-config/templates/smb.conf.j2 | 2 ++ roles/template-test/defaults/main.yml | 1 + roles/vdr/tasks/main.yml | 4 ++++ roles/yavdr-common/defaults/main.yml | 4 ++++ roles/yavdr-common/tasks/main.yml | 8 ++++++++ roles/yavdr-xorg/templates/openbox/autostart.j2 | 1 + roles/yavdr-xorg/templates/systemd/vdr-environ.j2 | 1 + roles/yavdr-xorg/templates/xorg-verbose.conf.j2 | 1 + roles/yavdr-xorg/templates/xorg.conf.j2 | 1 + 16 files changed, 36 insertions(+) diff --git a/Manual.org b/Manual.org index 893282b..6b398e5 100644 --- a/Manual.org +++ b/Manual.org @@ -1,4 +1,5 @@ # -*- mode: org; -*- +* Settings for Export # Local Variables: # org-src-preserve-indentation: t # End: diff --git a/group_vars/all b/group_vars/all index 4450c3a..4a17327 100644 --- a/group_vars/all +++ b/group_vars/all @@ -3,6 +3,7 @@ # this is the standard text to put in templates ansible_managed_file: "*** YAVDR: ANSIBLE MANAGED FILE ***" + branch: unstable ppa_owner: 'ppa:yavdr' # a list of all package repositories to be added to the installation @@ -12,6 +13,7 @@ repositories: - '{{ ppa_owner }}/{{branch}}-vdr' - '{{ ppa_owner }}/{{branch}}-yavdr' - '{{ ppa_owner }}/{{branch}}-kodi' + # properties of the user vdr and vdr-related options vdr: user: vdr @@ -31,6 +33,7 @@ vdr_plugins: - vdr-plugin-markad - vdr-plugin-restfulapi - vdr-plugin-softhddevice-vpp + # dictionary of directories for (shared) files. Automatically exported via NFS and Samba if those roles are enabled media_dirs: audio: /srv/audio @@ -39,11 +42,14 @@ media_dirs: files: /srv/files backups: /srv/backups recordings: '{{ vdr.recdir }}' + nfs: insecure: false # set to true for OS X clients or if you plan to use libnfs as unprivileged user (e.g. KODI) + samba: workgroup: YAVDR windows_compatible: '{{ vdr.safe_dirnames }}' # set to true to disable unix extensions, enable follow symlinks and wide links + # additional packages you want to install extra_packages: - vim @@ -52,6 +58,7 @@ extra_packages: - w-scan - bpython - bpython3 + frontend: vdr #system: # shutdown: poweroff diff --git a/handlers/main.yml b/handlers/main.yml index 840b674..d7fd733 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,3 +1,4 @@ + - name: Restart Samba systemd: name: smbd.service diff --git a/install-yavdr.sh b/install-yavdr.sh index d3bd2d8..d8aa931 100755 --- a/install-yavdr.sh +++ b/install-yavdr.sh @@ -1,4 +1,5 @@ #!/bin/bash + if (( $EUID != 0 )); then echo "This script must be run using sudo or as root" exit diff --git a/library/hardware_facts.py b/library/hardware_facts.py index 5ca2e82..7960027 100755 --- a/library/hardware_facts.py +++ b/library/hardware_facts.py @@ -1,4 +1,5 @@ #!/usr/bin/env/python + # This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules. DOCUMENTATION = ''' --- diff --git a/library/satip_facts.py b/library/satip_facts.py index 6fe23a9..7b2d4c5 100755 --- a/library/satip_facts.py +++ b/library/satip_facts.py @@ -1,4 +1,5 @@ #!/usr/bin/env python2 + DOCUMENTATION = ''' --- module: hardware_facts diff --git a/library/xrandr_facts.py b/library/xrandr_facts.py index 103ff27..1a5d4c9 100755 --- a/library/xrandr_facts.py +++ b/library/xrandr_facts.py @@ -1,4 +1,5 @@ #!/usr/bin/env python2 + from __future__ import print_function import ast import binascii diff --git a/roles/samba-config/templates/smb.conf.j2 b/roles/samba-config/templates/smb.conf.j2 index 42b03d9..befd2b7 100644 --- a/roles/samba-config/templates/smb.conf.j2 +++ b/roles/samba-config/templates/smb.conf.j2 @@ -77,6 +77,7 @@ follow symlinks= yes wide links= yes {% endif %} + {% for name, path in media_dirs.iteritems() %} [{{ name }}] path = {{ path }} @@ -92,4 +93,5 @@ wide links = yes {% endfor %} + include = /etc/samba/smb.conf.custom diff --git a/roles/template-test/defaults/main.yml b/roles/template-test/defaults/main.yml index da426aa..efd58a0 100644 --- a/roles/template-test/defaults/main.yml +++ b/roles/template-test/defaults/main.yml @@ -1,3 +1,4 @@ + foo: - bar - baz diff --git a/roles/vdr/tasks/main.yml b/roles/vdr/tasks/main.yml index eef93a1..1455a1d 100644 --- a/roles/vdr/tasks/main.yml +++ b/roles/vdr/tasks/main.yml @@ -10,6 +10,7 @@ - vdr - vdrctl - vdr-plugin-dbus2vdr + - name: add svdrp and svdrp-disc to /etc/services lineinfile: dest: /etc/services @@ -18,6 +19,7 @@ with_items: - "svdrp 6419/tcp" - "svdrp-disc 6419/udp" + - name: create vdr recdir file: state: directory @@ -47,6 +49,7 @@ vdr.hide_first_recording_level # TODO: set recdir, user etc. in /etc/vdr/conf.d/ + - name: apt | install additional vdr plugins apt: name: '{{ item }}' @@ -55,6 +58,7 @@ with_items: '{{ vdr_plugins | default({}) }}' notify: [ 'Restart VDR' ] + - name: ensure vdr is stopped systemd: name: vdr.service diff --git a/roles/yavdr-common/defaults/main.yml b/roles/yavdr-common/defaults/main.yml index 197cbcd..17c5dac 100644 --- a/roles/yavdr-common/defaults/main.yml +++ b/roles/yavdr-common/defaults/main.yml @@ -1,6 +1,7 @@ --- # file: roles/yavdr-common/defaults/main.yml + branch: unstable repositories: - 'ppa:yavdr/main' @@ -8,13 +9,16 @@ repositories: - 'ppa:yavdr/{{branch}}-vdr' - 'ppa:yavdr/{{branch}}-kodi' - 'ppa:yavdr/{{branch}}-yavdr' + drivers: sundtek: auto ddvb-dkms: auto + extra_packages: - vim - tree - w-scan + vdr: user: vdr group: vdr diff --git a/roles/yavdr-common/tasks/main.yml b/roles/yavdr-common/tasks/main.yml index c6a5e41..cda83e3 100644 --- a/roles/yavdr-common/tasks/main.yml +++ b/roles/yavdr-common/tasks/main.yml @@ -4,10 +4,12 @@ template: src: templates/90-norecommends.j2 dest: /etc/apt/apt.conf.d/90norecommends + - name: use bash instead of dash shell: | echo "set dash/sh false" | debconf-communicate dpkg-reconfigure -f noninteractive dash + - name: create vdr group group: gid: '{{ vdr.gid }}' @@ -23,6 +25,7 @@ shell: '/bin/bash' state: present append: true + - name: disable release-upgrade notifications lineinfile: dest: /etc/update-manager/release-upgrades @@ -30,6 +33,7 @@ state: present regexp: '^(Prompt=).*$' line: '\1never' + - name: add yaVDR PPAs apt_repository: repo: '{{ item }}' @@ -41,6 +45,7 @@ apt: upgrade: dist update_cache: yes + - name: apt | install basic packages apt: name: '{{ item }}' @@ -63,6 +68,7 @@ - wpasupplicant - usbutils - xfsprogs + - name: apt | install extra packages apt: name: '{{ item }}' @@ -70,6 +76,7 @@ install_recommends: no with_items: '{{ extra_packages }}' + - name: get information about usb and pci hardware and loaded kernel modules hardware_facts: usb: True @@ -88,6 +95,7 @@ - debug: var: gpus verbosity: 1 + - name: create media directories file: dest: '{{ item.value }}' diff --git a/roles/yavdr-xorg/templates/openbox/autostart.j2 b/roles/yavdr-xorg/templates/openbox/autostart.j2 index 3aa47c8..160c8e3 100755 --- a/roles/yavdr-xorg/templates/openbox/autostart.j2 +++ b/roles/yavdr-xorg/templates/openbox/autostart.j2 @@ -1,4 +1,5 @@ #!/bin/bash + # forward environment variables to an environment file and the systemd user session env | grep "DISPLAY\|DBUS_SESSION_BUS_ADDRESS\|XDG_RUNTIME_DIR" > ~/.session-env systemctl --user import-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS diff --git a/roles/yavdr-xorg/templates/systemd/vdr-environ.j2 b/roles/yavdr-xorg/templates/systemd/vdr-environ.j2 index a00d7ba..eef1e2b 100644 --- a/roles/yavdr-xorg/templates/systemd/vdr-environ.j2 +++ b/roles/yavdr-xorg/templates/systemd/vdr-environ.j2 @@ -1,2 +1,3 @@ + [Service] EnvironmentFile=-/var/lib/vdr/.session-env diff --git a/roles/yavdr-xorg/templates/xorg-verbose.conf.j2 b/roles/yavdr-xorg/templates/xorg-verbose.conf.j2 index bc15d63..6aa90c1 100644 --- a/roles/yavdr-xorg/templates/xorg-verbose.conf.j2 +++ b/roles/yavdr-xorg/templates/xorg-verbose.conf.j2 @@ -1,3 +1,4 @@ + Section "Device" Identifier "nvidia" Driver "nvidia" diff --git a/roles/yavdr-xorg/templates/xorg.conf.j2 b/roles/yavdr-xorg/templates/xorg.conf.j2 index 2658f1c..b244c52 100644 --- a/roles/yavdr-xorg/templates/xorg.conf.j2 +++ b/roles/yavdr-xorg/templates/xorg.conf.j2 @@ -1,3 +1,4 @@ + {{ ansible_managed_file | comment }} Section "ServerLayout"