]> gitweb.fluxo.info Git - puppet-nodo.git/commitdiff
Adding sound suport on node::vserver::instance
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 29 Jan 2010 19:37:33 +0000 (17:37 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 29 Jan 2010 19:37:33 +0000 (17:37 -0200)
files/sound/devices.sh [new file with mode: 0644]
manifests/init.pp

diff --git a/files/sound/devices.sh b/files/sound/devices.sh
new file mode 100644 (file)
index 0000000..405ed7a
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+VSERVER="$1"
+
+if [ -z "$VSERVER" ]; then
+  ROOT="/"
+else
+  ROOT="/var/vservers/$1"
+fi
+
+if [ "$2" == "--check" ]; then
+  if [ -e "$ROOT/dev/snd/controlC0" ]; then
+    exit 0
+  else
+    exit 1
+  fi
+fi
+
+mkdir $ROOT/dev/snd
+mknod $ROOT/dev/snd/controlC0 c 116 0
+mknod $ROOT/dev/snd/pcmC0D0c  c 116 24
+mknod $ROOT/dev/snd/pcmC0D0p  c 116 16
+mknod $ROOT/dev/snd/timer     c 116 33
+
+if [ -z "$VSERVER" ]; then
+  chown -R root:audio /dev/snd
+else
+  vserver $VSERVER exec chown -R root:audio /dev/snd
+fi
+
+chmod 660 $ROOT/dev/snd/*
index f04efdab7e8b59f718c109ff3927e19f912ba9f8..9822e525ba39cccafc6e4b75c23802b3044bae1a 100644 (file)
@@ -206,9 +206,23 @@ class nodo::vserver inherits nodo {
     #  tag  => $name,
     #}
 
-    # TODO: sound support
-    # http://wiki.debian.org/LinuxVserver
-    # http://seehuhn.de/pages/vserver
+    # Sound support
+    if $sound {
+      if !defined(File["/usr/local/sbin/create-sound-devices"]) {
+        file { "/usr/local/sbin/create-sound-devices":
+          ensure => present,
+          source => "puppet://$server/modules/nodo/sound/devices.sh",
+          user   => root,
+          group  => root,
+          mode   => 755,
+        }
+      }
+      exec { "/usr/local/sbin/create-sound-devices ${name}":
+        unless  => "/usr/local/sbin/create-sound-devices ${name} --check",
+        user    => root,
+        require => [ Exec["vs_create_${name}"], File["/usr/local/sbin/create-sound-devices"] ],
+      }
+    }
 
     # Apply firewall rules just for running vservers
     case $ensure {