summaryrefslogtreecommitdiff
path: root/community-testing/cdemu-daemon
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2012-03-12 00:01:32 +0000
committerroot <root@rshg054.dnsready.net>2012-03-12 00:01:32 +0000
commita6cb3ddef295c5feb4e03ee198dbb31cdf62d518 (patch)
tree4ea0c57a9a347779a3d69ebee2dc54d994a30235 /community-testing/cdemu-daemon
parent4640048ddd1331c9f6fc14b8921ccecdb6b1ea11 (diff)
Mon Mar 12 00:01:32 UTC 2012
Diffstat (limited to 'community-testing/cdemu-daemon')
-rw-r--r--community-testing/cdemu-daemon/60-vhba.rules1
-rw-r--r--community-testing/cdemu-daemon/PKGBUILD42
-rw-r--r--community-testing/cdemu-daemon/cdemu-daemon-system.patch15
-rw-r--r--community-testing/cdemu-daemon/cdemud.conf12
-rw-r--r--community-testing/cdemu-daemon/cdemud.install9
-rw-r--r--community-testing/cdemu-daemon/cdemud.rc55
6 files changed, 134 insertions, 0 deletions
diff --git a/community-testing/cdemu-daemon/60-vhba.rules b/community-testing/cdemu-daemon/60-vhba.rules
new file mode 100644
index 000000000..5ee03c807
--- /dev/null
+++ b/community-testing/cdemu-daemon/60-vhba.rules
@@ -0,0 +1 @@
+KERNEL=="vhba_ctl", MODE="0660", OWNER="root", GROUP="cdemu"
diff --git a/community-testing/cdemu-daemon/PKGBUILD b/community-testing/cdemu-daemon/PKGBUILD
new file mode 100644
index 000000000..72b9963fa
--- /dev/null
+++ b/community-testing/cdemu-daemon/PKGBUILD
@@ -0,0 +1,42 @@
+# $Id: PKGBUILD 67378 2012-03-10 20:04:28Z bpiotrowski $
+# Maintainer: Mateusz Herych <heniekk@gmail.com>
+# Contributor: Charles Lindsay <charles@chaoslizard.org>
+
+pkgname=cdemu-daemon
+pkgver=1.5.0
+pkgrel=2
+pkgdesc="CD/DVD-ROM device emulator daemon"
+arch=('i686' 'x86_64')
+backup=('etc/conf.d/cdemud'
+ 'etc/dbus-1/system.d/cdemud-dbus.conf')
+url="http://cdemu.sourceforge.net/"
+license=('GPL')
+depends=('glib2' 'dbus' 'dbus-glib' 'libdaemon' 'vhba-module' "libmirage=$pkgver" 'libao')
+install=cdemud.install
+source=(http://downloads.sourceforge.net/cdemu/$pkgname-$pkgver.tar.bz2
+ cdemud.conf cdemud.rc 60-vhba.rules cdemu-daemon-system.patch)
+md5sums=('5ba780caa26d855942512b5b3c22405a'
+ 'd65c30651389900c46e62a9e5559b9d5'
+ 'ef47f06a3d4e07885bfbb57d4d6d0be4'
+ 'f551504552d7693ac79e8e0d302f62b9'
+ 'a3ae9c51c460d31a521dd00dd3f0a852')
+
+build() {
+ cd $srcdir/$pkgname-$pkgver
+ patch -Np0 -i $srcdir/cdemu-daemon-system.patch
+ ./configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib/$pkgname
+ make
+}
+
+package() {
+ cd $srcdir/$pkgname-$pkgver
+ make DESTDIR=$pkgdir install
+ install -m 644 -D ../cdemud.conf $pkgdir/etc/conf.d/cdemud
+ install -m 755 -D ../cdemud.rc $pkgdir/etc/rc.d/cdemud
+
+ # Install udev rule for non-root mounting of iso's
+ install -D -m 644 "${srcdir}/60-vhba.rules" "$pkgdir/lib/udev/rules.d/60-vhba.rules"
+
+ install -d "$pkgdir/usr/lib/modules-load.d"
+ echo "vhba" > "$pkgdir/usr/lib/modules-load.d/cdemu.conf"
+}
diff --git a/community-testing/cdemu-daemon/cdemu-daemon-system.patch b/community-testing/cdemu-daemon/cdemu-daemon-system.patch
new file mode 100644
index 000000000..ce4dab7d9
--- /dev/null
+++ b/community-testing/cdemu-daemon/cdemu-daemon-system.patch
@@ -0,0 +1,15 @@
+--- system/cdemu-daemon-system.sh.orig 2012-02-27 21:38:05.000000000 +0100
++++ system/cdemu-daemon-system.sh 2012-03-10 20:53:06.787503891 +0100
+@@ -6,10 +6,10 @@
+ # Default settings
+ NUM_DEVICES=2
+ AUDIO_DRIVER=null
+-LOG_FILE=/tmp/cdemu-daemon.log
++LOG_FILE=/var/log/cdemu-daemon.log
+
+ # Read the settings
+-CONFIG_FILE=/etc/sysconfig/cdemu-daemon
++CONFIG_FILE=/etc/conf.d/cdemud
+
+ if [ -f ${CONFIG_FILE} ]; then
+ . ${CONFIG_FILE};
diff --git a/community-testing/cdemu-daemon/cdemud.conf b/community-testing/cdemu-daemon/cdemud.conf
new file mode 100644
index 000000000..4e0e314f4
--- /dev/null
+++ b/community-testing/cdemu-daemon/cdemud.conf
@@ -0,0 +1,12 @@
+# how many optical drives to emulate
+NUM_DEVICES=2
+
+# control device
+CTL_DEVICE=/dev/vhba_ctl
+
+# audio backend (null or alsa)
+AUDIO_DRIVER=null
+
+DAEMON="/usr/bin/cdemud"
+BUS="system"
+LOG_FILE="/var/log/cdemu.log"
diff --git a/community-testing/cdemu-daemon/cdemud.install b/community-testing/cdemu-daemon/cdemud.install
new file mode 100644
index 000000000..699b3f0e5
--- /dev/null
+++ b/community-testing/cdemu-daemon/cdemud.install
@@ -0,0 +1,9 @@
+post_install () {
+ echo ">> Place 'cdemud' in DAEMONS= in /etc/rc.conf to enable cdemud on system boot."
+ echo ">> If the alsa-lib package is installed, cdemud can use the ALSA audio backend"
+ echo ">> (edit /etc/conf.d/cdemud to enable this)."
+ groupadd cdemu
+}
+post_remove() {
+ groupdel cdemu
+}
diff --git a/community-testing/cdemu-daemon/cdemud.rc b/community-testing/cdemu-daemon/cdemud.rc
new file mode 100644
index 000000000..21cae0a26
--- /dev/null
+++ b/community-testing/cdemu-daemon/cdemud.rc
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/cdemud
+
+case "$1" in
+ start)
+ stat_busy "Loading vhba and loop modules"
+ modprobe vhba
+ if [ $? -ne 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+
+ stat_busy "Waiting for $CTL_DEVICE"
+ i=0
+ until [ -c $CTL_DEVICE -o $i -ge 10 ]; do
+ i=`expr $i + 1`
+ sleep 1
+ done
+ if [ -c $CTL_DEVICE ]; then
+ stat_done
+ else
+ stat_fail
+ fi
+
+ stat_busy "Starting cdemud"
+ cdemud --ctl-device=$CTL_DEVICE --bus=$BUS --num-devices=$NUM_DEVICES --audio-driver=$AUDIO_DRIVER --logfile=$LOG_FILE &
+ if [ $? -ne 0 ]; then
+ stat_fail
+ else
+ add_daemon cdemud
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping cdemud"
+ kill -9 `pidof cdemud` &>/dev/null && sleep 1 && rmmod vhba
+ if [ $? -ne 0 ]; then
+ stat_fail
+ else
+ rm_daemon cdemud
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac