summaryrefslogtreecommitdiff
path: root/community/cdemu-daemon
diff options
context:
space:
mode:
authorParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
committerParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
commit415856bdd4f48ab4f2732996f0bae58595092bbe (patch)
treeede2018b591f6dfb477fe9341ba17b9bc000fab9 /community/cdemu-daemon
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'community/cdemu-daemon')
-rw-r--r--community/cdemu-daemon/60-vhba.rules1
-rw-r--r--community/cdemu-daemon/PKGBUILD40
-rw-r--r--community/cdemu-daemon/cdemud.conf8
-rw-r--r--community/cdemu-daemon/cdemud.install9
-rw-r--r--community/cdemu-daemon/cdemud.rc56
5 files changed, 114 insertions, 0 deletions
diff --git a/community/cdemu-daemon/60-vhba.rules b/community/cdemu-daemon/60-vhba.rules
new file mode 100644
index 000000000..0a80d63e0
--- /dev/null
+++ b/community/cdemu-daemon/60-vhba.rules
@@ -0,0 +1 @@
+KERNEL=="vhba_ctl", NAME="%k", MODE="0660", OWNER="root", GROUP="cdemu"
diff --git a/community/cdemu-daemon/PKGBUILD b/community/cdemu-daemon/PKGBUILD
new file mode 100644
index 000000000..bdea742ae
--- /dev/null
+++ b/community/cdemu-daemon/PKGBUILD
@@ -0,0 +1,40 @@
+# $Id: PKGBUILD 40133 2011-02-20 13:02:28Z jelle $
+# Maintainer: Mateusz Herych <heniekk@gmail.com>
+# Contributor: Charles Lindsay <charles@chaoslizard.org>
+
+pkgname=cdemu-daemon
+pkgver=1.3.0
+pkgrel=4
+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' 'libao')
+install=cdemud.install
+source=(http://downloads.sourceforge.net/cdemu/$pkgname-$pkgver.tar.gz
+ cdemud.conf
+ cdemud.rc
+ 60-vhba.rules)
+md5sums=('4ec07bd202ac1dcc2f352fc394268d67'
+ '26b94a626c2c1d0a83ad5a7593dff70f'
+ '655b2bf46802f2fa7821a649cecd1c4d'
+ '93324b320e7b68d01ad9a0b548018ed5')
+
+build() {
+ cd $srcdir/$pkgname-$pkgver
+ ./configure --prefix=/usr --sysconfdir=/etc
+ 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 755 "${srcdir}/60-vhba.rules" "$pkgdir/lib/udev/rules.d/60-vhba.rules"
+
+}
diff --git a/community/cdemu-daemon/cdemud.conf b/community/cdemu-daemon/cdemud.conf
new file mode 100644
index 000000000..91ada613f
--- /dev/null
+++ b/community/cdemu-daemon/cdemud.conf
@@ -0,0 +1,8 @@
+# how many optical drives to emulate
+NUM_DRIVES=1
+
+# control device
+CTL_DEVICE=/dev/vhba_ctl
+
+# audio backend (null or alsa)
+AUDIO_BACKEND=null
diff --git a/community/cdemu-daemon/cdemud.install b/community/cdemu-daemon/cdemud.install
new file mode 100644
index 000000000..699b3f0e5
--- /dev/null
+++ b/community/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/cdemu-daemon/cdemud.rc b/community/cdemu-daemon/cdemud.rc
new file mode 100644
index 000000000..c13fa6239
--- /dev/null
+++ b/community/cdemu-daemon/cdemud.rc
@@ -0,0 +1,56 @@
+#!/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 loop
+ 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 -d -n $NUM_DRIVES -c $CTL_DEVICE -a $AUDIO_BACKEND &>/dev/null
+ if [ $? -ne 0 ]; then
+ stat_fail
+ else
+ add_daemon cdemud
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping cdemud"
+ cdemud -k &>/dev/null
+ 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