system/cdemu-daemon: Updated for version 1.4.0.

Signed-off-by: Erik Hanson <erik@slackbuilds.org>
This commit is contained in:
Niels Horn 2011-10-04 08:15:58 -05:00 committed by Robby Workman
parent c7b6e320db
commit 98d02cc48f
7 changed files with 81 additions and 128 deletions

View file

@ -6,4 +6,4 @@ To use another group ex. cdemu run the script like this:
GROUP=cdemu ./cdemu-daemon.SlackBuild GROUP=cdemu ./cdemu-daemon.SlackBuild
This requires libdaemon, libmirage, and vhba-module. This requires libmirage and vhba-module.

View file

@ -3,7 +3,7 @@
# Slackware build script for cdemu-daemon # Slackware build script for cdemu-daemon
# #
# Copyright 2008 Niklas "Nille" Åkerström # Copyright 2008 Niklas "Nille" Åkerström
# Copyright 2010 Niels Horn # Copyright 2010-2011 Niels Horn, Rio de Janeiro, RJ, Brazil
# All rights reserved. # All rights reserved.
# #
# Redistribution and use of this script, with or without modification, is # Redistribution and use of this script, with or without modification, is
@ -23,11 +23,10 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Maintained as of version 1.3.0 by Niels Horn <niels.horn@gmail.com> # Revision date: 2011/09/24
# Revision date: 2010/11/20
PRGNAM=cdemu-daemon PRGNAM=cdemu-daemon
VERSION=${VERSION:-1.3.0} VERSION=${VERSION:-1.4.0}
BUILD=${BUILD:-1} BUILD=${BUILD:-1}
TAG=${TAG:-_SBo} TAG=${TAG:-_SBo}
@ -84,10 +83,15 @@ CXXFLAGS="$SLKCFLAGS" \
make make
make install-strip DESTDIR=$PKG make install-strip DESTDIR=$PKG
# Fix standard configuration to make it more "Slackware"-like
sed \
-e "/^LOG_FILE/s|/tmp/|/var/log/|" \
-e "/^CONFIG_FILE/s|/etc/sysconfig/|/etc/|" \
-i $PKG/usr/bin/$PRGNAM-system.sh
# Install init script # Install init script
mkdir -p $PKG/etc/rc.d mkdir -p $PKG/etc/rc.d
install -m 0755 $CWD/rc.cdemud $PKG/etc/rc.d/rc.cdemud.new 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 # dbus and udev rules
mv $PKG/etc/dbus-1/system.d/cdemud-dbus.conf \ mv $PKG/etc/dbus-1/system.d/cdemud-dbus.conf \

View file

@ -1,10 +1,10 @@
PRGNAM="cdemu-daemon" PRGNAM="cdemu-daemon"
VERSION="1.3.0" VERSION="1.4.0"
HOMEPAGE="http://cdemu.sourceforge.net/pkg_daemon.php" HOMEPAGE="http://cdemu.sourceforge.net/pkg_daemon.php"
DOWNLOAD="http://downloads.sourceforge.net/cdemu/cdemu-daemon-1.3.0.tar.gz" DOWNLOAD="http://downloads.sourceforge.net/cdemu/cdemu-daemon-1.4.0.tar.gz"
MD5SUM="4ec07bd202ac1dcc2f352fc394268d67" MD5SUM="f7ccc0abc33057d552ec7b0925fce63a"
DOWNLOAD_x86_64="" DOWNLOAD_x86_64=""
MD5SUM_x86_64="" MD5SUM_x86_64=""
MAINTAINER="Niels Horn" MAINTAINER="Niels Horn"
EMAIL="niels.horn@gmail.com" EMAIL="niels.horn@gmail.com"
APPROVED="pprkut" APPROVED="Erik Hanson"

View file

@ -10,15 +10,18 @@ config() {
# Otherwise, we leave the .new copy for the admin to consider... # Otherwise, we leave the .new copy for the admin to consider...
} }
# Keep same perms on rc.cdemud.new: preserve_perms() {
if [ -e etc/rc.d/rc.cdemud ]; then NEW="$1"
cp -a etc/rc.d/rc.cdemud etc/rc.d/rc.cdemud.new.incoming OLD="$(dirname $NEW)/$(basename $NEW .new)"
cat etc/rc.d/rc.cdemud.new > etc/rc.d/rc.cdemud.new.incoming if [ -e $OLD ]; then
mv etc/rc.d/rc.cdemud.new.incoming etc/rc.d/rc.cdemud.new cp -a $OLD ${NEW}.incoming
fi cat $NEW > ${NEW}.incoming
mv ${NEW}.incoming $NEW
fi
config $NEW
}
config etc/rc.d/rc.cdemud.new preserve_perms 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/dbus-1/system.d/cdemud-dbus.conf.new
config etc/udev/rules.d/99-vhba.rules.new config etc/udev/rules.d/99-vhba.rules.new

View file

@ -16,19 +16,17 @@
NAME="cdemud" NAME="cdemud"
DESC="cdemu-daemon" DESC="cdemu-daemon"
LOCK="/var/lock/${DESC}.lock" MODULE="vhba"
CTL_DEVICE="/dev/vhba_ctl"
PID=$(/sbin/pidof -o %PPID ${NAME}) PID=$(/sbin/pidof -o %PPID ${NAME})
# Get the configuration information from /etc/rc.d/rc.cdemud.conf:
. /etc/rc.d/rc.cdemud.conf
start() start()
{ {
# Check if already started # Check if already started
if [ -n "${PID}" ] ;then if [ -n "${PID}" ] ;then
echo "${DESC} is already running at pid: ${PID}" echo "${DESC} is already running at pid: ${PID}"
return ${RETVAL} return ${RETVAL}
exit exit
fi fi
# Load module # Load module
@ -36,10 +34,11 @@ start()
echo -n "Inserting ${MODULE} kernel module" echo -n "Inserting ${MODULE} kernel module"
modprobe "${MODULE}" >/dev/null 2>&1 modprobe "${MODULE}" >/dev/null 2>&1
RETVAL=$? RETVAL=$?
if [ ${RETVAL} -eq 0 ]; then if [ ${RETVAL} -eq 0 ]; then
echo -e "\t\t\t\t\t[ OK ]\r" echo -e "\t\t\t\t\t[ OK ]\r"
else else
echo -e "\t\t\t\t\t[FAILED]\r" echo -e "\t\t\t\t\t[FAILED]\r"
exit 1
fi fi
fi fi
@ -59,97 +58,70 @@ start()
fi fi
done done
if [ ${RETVAL} -eq 0 ]; then if [ ${RETVAL} -eq 0 ]; then
echo -e "\t\t\t\t[ OK ]\r" echo -e "\t\t\t\t[ OK ]\r"
else else
echo -e "\t\t\t\t[FAILED]\r" echo -e "\t\t\t\t[FAILED]\r"
exit 1
fi fi
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 # Start daemon
echo -n "Starting ${DESC}" # ... we don't really start the daemon, this is done by dbus
$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} return ${RETVAL}
} }
stop() stop()
{ {
# Stopping daemon # Stopping daemon
echo -n "Stopping ${DESC}" echo -n "Stopping ${DESC}"
if [ -n "${PID}" ] ;then if [ -n "${PID}" ] ;then
$NAME -k >/dev/null 2>&1 kill ${PID}
RETVAL=$? RETVAL=$?
if [ ${RETVAL} -eq 0 ]; then if [ ${RETVAL} -eq 0 ]; then
echo -e "\t\t\t\t\t\t[ OK ]\r" echo -e "\t\t\t\t\t\t[ OK ]\r"
else else
echo -e "\t\t\t\t\t\t[FAILED]\r" echo -e "\t\t\t\t\t\t[FAILED]\r"
fi fi
else sleep 2
echo -e "\t\t\t\tWarning: ${DESC} isn't running" else
RETVAL=0 echo -e "\t\t\t\tWarning: ${DESC} isn't running"
fi RETVAL=0
fi
# Unload module # Unload module
echo -n "Removing ${MODULE} kernel module" echo -n "Removing ${MODULE} kernel module"
LOADED=`lsmod | grep -o -e ^${MODULE} -` LOADED=`lsmod | grep -o -e ^${MODULE} -`
if [ "${LOADED}" = "${MODULE}" ]; then if [ "${LOADED}" = "${MODULE}" ]; then
modprobe -r "${MODULE}" >/dev/null 2>&1 modprobe -r "${MODULE}" >/dev/null 2>&1
RETVAL=$? RETVAL=$?
if [ ${RETVAL} -eq 0 ]; then if [ ${RETVAL} -eq 0 ]; then
echo -e "\t\t\t\t\t[ OK ]\r" echo -e "\t\t\t\t\t[ OK ]\r"
else else
echo -e "\t\t\t\t\t[FAILED]\r" echo -e "\t\t\t\t\t[FAILED]\r"
fi fi
return ${RETVAL} else
if [ $RETVAL -eq 0 ]; then echo -e "\t\t\tWarning: ${MODULE} isn't loaded"
rm -f $LOCK RETVAL=0
fi fi
else return ${RETVAL}
echo -e "\t\t\tWarning: ${MODULE} isn't loaded"
RETVAL=0
fi
return ${RETVAL}
} }
restart() { restart() {
stop stop
RETVAL=$? RETVAL=$?
if [ ${RETVAL} -eq 0 ]; then if [ ${RETVAL} -eq 0 ]; then
PID=$(/sbin/pidof -o %PPID ${NAME}) PID=$(/sbin/pidof -o %PPID ${NAME})
start start
RETVAL=$? RETVAL=$?
if [ ${RETVAL} -ne 0 ]; then if [ ${RETVAL} -ne 0 ]; then
echo "Couldn't start ${DESC} retry in 3sec." echo "Couldn't start ${DESC} retry in 3sec."
sleep 3 sleep 3
start start
RETVAL=$? RETVAL=$?
fi fi
fi fi
return ${RETVAL} return ${RETVAL}
} }
# See how we were called. # See how we were called.

View file

@ -1,26 +0,0 @@
# /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=

View file

@ -5,7 +5,7 @@
# make exactly 11 lines for the formatting to be correct. It's also # make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'. # customary to leave one space after the ':'.
|----------------------------handy-ruler---------------------------| |----------------------------handy-ruler-------------------------------|
cdemu-daemon: CDEmu daemon (userspace daemon part of the cdemu suite) cdemu-daemon: CDEmu daemon (userspace daemon part of the cdemu suite)
cdemu-daemon: cdemu-daemon:
cdemu-daemon: It receives SCSI commands from kernel module and processes them, cdemu-daemon: It receives SCSI commands from kernel module and processes them,