aboutsummaryrefslogtreecommitdiff
path: root/system/cdemu-daemon
diff options
context:
space:
mode:
Diffstat (limited to 'system/cdemu-daemon')
-rw-r--r--system/cdemu-daemon/README9
-rw-r--r--system/cdemu-daemon/README.SLACKWARE17
-rw-r--r--system/cdemu-daemon/cdemu-daemon.SlackBuild103
-rw-r--r--system/cdemu-daemon/cdemu-daemon.info8
-rw-r--r--system/cdemu-daemon/doinst.sh27
-rw-r--r--system/cdemu-daemon/rc.cdemud174
-rw-r--r--system/cdemu-daemon/rc.cdemud.conf26
-rw-r--r--system/cdemu-daemon/slack-desc19
8 files changed, 383 insertions, 0 deletions
diff --git a/system/cdemu-daemon/README b/system/cdemu-daemon/README
new file mode 100644
index 0000000000000..1b2df24079131
--- /dev/null
+++ b/system/cdemu-daemon/README
@@ -0,0 +1,9 @@
+CDEmu daemon is the userspace daemon part of the cdemu suite.
+a free, GPL CD/DVD-ROM device emulator for linux.
+
+This SlackBuild uses group cdrom as default.
+To use another group ex. cdemu run the script like this:
+GROUP=cdemu ./cdemu-daemon.SlackBuild
+
+cdemu-daemon requires libdaemon, libmirage, and vhba-module, all of
+which are available from SlackBuilds.org
diff --git a/system/cdemu-daemon/README.SLACKWARE b/system/cdemu-daemon/README.SLACKWARE
new file mode 100644
index 0000000000000..53a905c99453b
--- /dev/null
+++ b/system/cdemu-daemon/README.SLACKWARE
@@ -0,0 +1,17 @@
+README.SLACKWARE
+
+To start the cdemu-daemon at boot, add the following to /etc/rc.d/rc.local:
+
+ # Start cdemu-daemon.
+ if [ -x /etc/rc.d/rc.cdemud ]; then
+ /etc/rc.d/rc.cdemud start
+ fi
+
+Add this to /etc/rc.d/rc.local_shutdown (if this file does not already
+exist, create it and make it executable):
+
+ # Stop cdemu-daemon.
+ if [ -x /etc/rc.d/rc.cdemud ]; then
+ /etc/rc.d/rc.cdemud stop
+ fi
+
diff --git a/system/cdemu-daemon/cdemu-daemon.SlackBuild b/system/cdemu-daemon/cdemu-daemon.SlackBuild
new file mode 100644
index 0000000000000..10df638abb37f
--- /dev/null
+++ b/system/cdemu-daemon/cdemu-daemon.SlackBuild
@@ -0,0 +1,103 @@
+#!/bin/sh
+
+# Slackware build script for cdemu-daemon
+#
+# Copyright 2008 Niklas "Nille" Åkerström
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PRGNAM=cdemu-daemon
+VERSION=1.1.0
+ARCH=${ARCH:-i486}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+GROUP=${GROUP:-cdrom}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
+cd $PRGNAM-$VERSION
+chown -R root:root .
+chmod -R a-s,u+rw,go+r-w .
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/$PRGNAM-$VERSION \
+ --build=$ARCH-slackware-linux \
+ --host=$ARCH-slackware-linux
+
+make
+make install-strip DESTDIR=$PKG
+
+# Install init script
+mkdir -p $PKG/etc/rc.d
+install -m 0755 $CWD/rc.cdemud $PKG/etc/rc.d/rc.cdemud.new
+cat $CWD/rc.cdemud.conf > $PKG/etc/rc.d/rc.cdemud.conf.new
+
+# dbus and udev rules
+mv $PKG/etc/dbus-1/system.d/cdemud-dbus.conf \
+ $PKG/etc/dbus-1/system.d/cdemud-dbus.conf.new
+sed -i 's/group="cdemu"/group="'$GROUP'"/' \
+ $PKG/etc/dbus-1/system.d/cdemud-dbus.conf.new
+mkdir -p $PKG/etc/udev/rules.d
+echo 'KERNEL=="vhba_ctl", NAME="%k", MODE="0660", OWNER="root", GROUP="'$GROUP'"' \
+ > $PKG/etc/udev/rules.d/99-vhba.rules.new
+
+( cd $PKG/usr/man
+ find . -type f -exec gzip -9 {} \;
+ for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+)
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp AUTHORS ChangeLog COPYING NEWS README $CWD/README.SLACKWARE \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
+
+if [ "$1" = "--cleanup" ]; then
+ rm -rf $PKG $TMP/$PRGNAM-$VERSION
+ fi
diff --git a/system/cdemu-daemon/cdemu-daemon.info b/system/cdemu-daemon/cdemu-daemon.info
new file mode 100644
index 0000000000000..3717608616b98
--- /dev/null
+++ b/system/cdemu-daemon/cdemu-daemon.info
@@ -0,0 +1,8 @@
+PRGNAM="cdemu-daemon"
+VERSION="1.1.0"
+HOMEPAGE="http://cdemu.sourceforge.net/pkg_daemon.php"
+DOWNLOAD="http://downloads.sourceforge.net/cdemu/cdemu-daemon-1.1.0.tar.bz2"
+MD5SUM="0118e5f590d7c0e1b02027b718880ac6"
+MAINTAINER="Niklas 'Nille' Åkerström"
+EMAIL="nille.kungen[AT]gmail.com"
+APPROVED="dsomero rworkman"
diff --git a/system/cdemu-daemon/doinst.sh b/system/cdemu-daemon/doinst.sh
new file mode 100644
index 0000000000000..f984fef7d7c2a
--- /dev/null
+++ b/system/cdemu-daemon/doinst.sh
@@ -0,0 +1,27 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+# Keep same perms on rc.cdemud.new:
+if [ -e etc/rc.d/rc.cdemud ]; then
+ cp -a etc/rc.d/rc.cdemud etc/rc.d/rc.cdemud.new.incoming
+ cat etc/rc.d/rc.cdemud.new > etc/rc.d/rc.cdemud.new.incoming
+ mv etc/rc.d/rc.cdemud.new.incoming etc/rc.d/rc.cdemud.new
+fi
+
+config etc/rc.d/rc.cdemud.new
+config etc/rc.d/rc.cdemud.conf.new
+config etc/dbus-1/system.d/cdemud-dbus.conf.new
+config etc/udev/rules.d/99-vhba.rules.new
+
+# Reload dbus configuration
+chroot . /etc/rc.d/rc.messagebus reload
+
diff --git a/system/cdemu-daemon/rc.cdemud b/system/cdemu-daemon/rc.cdemud
new file mode 100644
index 0000000000000..5be12abe3b8d4
--- /dev/null
+++ b/system/cdemu-daemon/rc.cdemud
@@ -0,0 +1,174 @@
+#!/bin/sh
+#
+# cdemu-daemon: CDEmu daemon
+#
+
+### BEGIN INIT INFO
+# Provides: cdemu-daemon
+# Short-Description: Start the CDEmu daemon
+# Description: System mode startup script for
+# the CDEmu daemon.
+### END INIT INFO
+
+# This script is based on the ubuntu and fedora init script.
+# Modified by Nille Åkerström
+
+NAME="cdemud"
+DESC="cdemu-daemon"
+LOCK="/var/lock/${DESC}.lock"
+PID=$(/sbin/pidof -o %PPID ${NAME})
+
+# Get the configuration information from /etc/rc.d/rc.cdemud.conf:
+. /etc/rc.d/rc.cdemud.conf
+
+start()
+{
+ # Check if already started
+ if [ -n "${PID}" ] ;then
+ echo "${DESC} is already running at pid: ${PID}"
+ return ${RETVAL}
+ exit
+ fi
+
+ # Load module
+ if [ -n "${MODULE}" ]; then
+ echo -n "Inserting ${MODULE} kernel module"
+ modprobe "${MODULE}" >/dev/null 2>&1
+ RETVAL=$?
+ if [ ${RETVAL} -eq 0 ]; then
+ echo -e "\t\t\t\t\t[ OK ]\r"
+ else
+ echo -e "\t\t\t\t\t[FAILED]\r"
+ fi
+ fi
+
+ # Wait until control device is created...
+ if [ -n "${CTL_DEVICE}" ]; then
+ echo -n "Waiting for ${CTL_DEVICE} to be created"
+
+ CTL_WAIT=30 # Wait at most 30 seconds
+ RETVAL=1
+ until [ ${CTL_WAIT} -eq 0 ]; do
+ if [ -c "${CTL_DEVICE}" ]; then
+ CTL_WAIT=0
+ RETVAL=0
+ else
+ CTL_WAIT=$((CTL_WAIT-1))
+ sleep 1
+ fi
+ done
+
+ if [ ${RETVAL} -eq 0 ]; then
+ echo -e "\t\t\t\t[ OK ]\r"
+ else
+ echo -e "\t\t\t\t[FAILED]\r"
+ fi
+ fi
+
+
+ # Daemon arguments
+ DAEMON_ARGS="--daemonize"
+
+ if [ -n "${DEVICES}" ]; then
+ DAEMON_ARGS="${DAEMON_ARGS} --num-devices=${DEVICES}"
+ fi
+ if [ -n "${CTL_DEVICE}" ]; then
+ DAEMON_ARGS="${DAEMON_ARGS} --ctl-device=${CTL_DEVICE}"
+ fi
+ if [ -n "${AUDIO_DRIVER}" ]; then
+ DAEMON_ARGS="${DAEMON_ARGS} --audio-driver=${AUDIO_DRIVER}"
+ fi
+ if [ -n "${BUS}" ]; then
+ DAEMON_ARGS="${DAEMON_ARGS} --bus=${BUS}"
+ fi
+
+ # Start daemon
+ echo -n "Starting ${DESC}"
+ $NAME ${DAEMON_ARGS} >/dev/null 2>&1
+ RETVAL=$?
+ if [ ${RETVAL} -eq 0 ] && touch ${LOCK} ; then
+ echo -e "\t\t\t\t\t\t[ OK ]\r"
+ else
+ echo -e "\t\t\t\t\t\t[FAILED]\r"
+ fi
+ return ${RETVAL}
+}
+
+stop()
+{
+ # Stopping daemon
+ echo -n "Stopping ${DESC}"
+ if [ -n "${PID}" ] ;then
+ $NAME -k >/dev/null 2>&1
+ RETVAL=$?
+ if [ ${RETVAL} -eq 0 ]; then
+ echo -e "\t\t\t\t\t\t[ OK ]\r"
+ else
+ echo -e "\t\t\t\t\t\t[FAILED]\r"
+ fi
+ else
+ echo -e "\t\t\t\tWarning: ${DESC} isn't running"
+ RETVAL=0
+ fi
+
+
+ # Unload module
+ echo -n "Removing ${MODULE} kernel module"
+ LOADED=`lsmod | grep -o -e ^${MODULE} -`
+ if [ "${LOADED}" = "${MODULE}" ]; then
+ modprobe -r "${MODULE}" >/dev/null 2>&1
+ RETVAL=$?
+ if [ ${RETVAL} -eq 0 ]; then
+ echo -e "\t\t\t\t\t[ OK ]\r"
+ else
+ echo -e "\t\t\t\t\t[FAILED]\r"
+ fi
+ return ${RETVAL}
+ if [ $RETVAL -eq 0 ]; then
+ rm -f $LOCK
+ fi
+ else
+ echo -e "\t\t\tWarning: ${MODULE} isn't loaded"
+ RETVAL=0
+ fi
+ return ${RETVAL}
+}
+
+restart() {
+ stop
+ RETVAL=$?
+ if [ ${RETVAL} -eq 0 ]; then
+ PID=$(/sbin/pidof -o %PPID ${NAME})
+ start
+ RETVAL=$?
+ if [ ${RETVAL} -ne 0 ]; then
+ echo "Couldn't start ${DESC} retry in 3sec."
+ sleep 3
+ start
+ RETVAL=$?
+ fi
+ fi
+ return ${RETVAL}
+}
+
+# See how we were called.
+case "$1" in
+ "start")
+ start
+ ;;
+ "stop")
+ stop
+ ;;
+ "restart")
+ restart
+ ;;
+ "force-reload" | "reload")
+ echo "Warning: Not implemented"
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|force-reload|reload}"
+ ;;
+esac
+
+exit ${RETVAL}
+
diff --git a/system/cdemu-daemon/rc.cdemud.conf b/system/cdemu-daemon/rc.cdemud.conf
new file mode 100644
index 0000000000000..aff5ed0a92d62
--- /dev/null
+++ b/system/cdemu-daemon/rc.cdemud.conf
@@ -0,0 +1,26 @@
+# /etc/rc.d/rc.cdemud.conf
+#
+# This file contains the configuration settings for cdemu-daemon.
+
+# Number off devices to use.
+# Specifies the number of virtual devices the daemon instance should register
+# with kernel module and control
+DEVICES=1
+
+# Control device. Specifies the control device path.
+# Control device is a character device provided by kernel module;
+# it is used for communication between kernel and userspace part of CDEmu suite.
+CTL_DEVICE=/dev/vhba_ctl
+
+# Audio driver. Specifies audio driver to be used by virtual devices' audio play.
+# Since libao is used for audio playback, any valid libao driver can be specified.
+AUDIO_DRIVER=alsa
+
+# Module tells the initscript what module to load.
+# on older versions cdemu were used but now it uses vhba.
+# This should never be changed.
+MODULE=vhba
+
+# Bus type. Valid options are system or session. By default, system bus is used.
+# This should never be used unless you have a really good reason for it.
+#BUS=
diff --git a/system/cdemu-daemon/slack-desc b/system/cdemu-daemon/slack-desc
new file mode 100644
index 0000000000000..85285211a60cd
--- /dev/null
+++ b/system/cdemu-daemon/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |----------------------------handy-ruler---------------------------|
+cdemu-daemon: CDEmu daemon (userspace daemon part of the cdemu suite)
+cdemu-daemon:
+cdemu-daemon: It receives SCSI commands from kernel module and processes them,
+cdemu-daemon: passing the requested data back to the kernel.
+cdemu-daemon: Daemon implements the actual virtual device;
+cdemu-daemon: one instance per each device registered by kernel module.
+cdemu-daemon: It uses libMirage, an image access library that is part of
+cdemu-daemon: demu suite, for the image access.
+cdemu-daemon:
+cdemu-daemon: Homepage: http://cdemu.sourceforge.net/pkg_daemon.php
+cdemu-daemon: