diff options
-rw-r--r-- | system/cdemu-daemon/README | 2 | ||||
-rw-r--r-- | system/cdemu-daemon/cdemu-daemon.SlackBuild | 14 | ||||
-rw-r--r-- | system/cdemu-daemon/cdemu-daemon.info | 8 | ||||
-rw-r--r-- | system/cdemu-daemon/doinst.sh | 19 | ||||
-rw-r--r-- | system/cdemu-daemon/rc.cdemud | 138 | ||||
-rw-r--r-- | system/cdemu-daemon/rc.cdemud.conf | 26 | ||||
-rw-r--r-- | system/cdemu-daemon/slack-desc | 2 |
7 files changed, 81 insertions, 128 deletions
diff --git a/system/cdemu-daemon/README b/system/cdemu-daemon/README index 5e90f0284d..ed15af8c8b 100644 --- a/system/cdemu-daemon/README +++ b/system/cdemu-daemon/README @@ -6,4 +6,4 @@ To use another group ex. cdemu run the script like this: GROUP=cdemu ./cdemu-daemon.SlackBuild -This requires libdaemon, libmirage, and vhba-module. +This requires libmirage and vhba-module. diff --git a/system/cdemu-daemon/cdemu-daemon.SlackBuild b/system/cdemu-daemon/cdemu-daemon.SlackBuild index d5b0441184..667b0036da 100644 --- a/system/cdemu-daemon/cdemu-daemon.SlackBuild +++ b/system/cdemu-daemon/cdemu-daemon.SlackBuild @@ -3,7 +3,7 @@ # Slackware build script for cdemu-daemon # # Copyright 2008 Niklas "Nille" Åkerström -# Copyright 2010 Niels Horn +# Copyright 2010-2011 Niels Horn, Rio de Janeiro, RJ, Brazil # All rights reserved. # # 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 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# Maintained as of version 1.3.0 by Niels Horn <niels.horn@gmail.com> -# Revision date: 2010/11/20 +# Revision date: 2011/09/24 PRGNAM=cdemu-daemon -VERSION=${VERSION:-1.3.0} +VERSION=${VERSION:-1.4.0} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -84,10 +83,15 @@ CXXFLAGS="$SLKCFLAGS" \ make 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 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 \ diff --git a/system/cdemu-daemon/cdemu-daemon.info b/system/cdemu-daemon/cdemu-daemon.info index 77c0b5d079..14fc52d5f1 100644 --- a/system/cdemu-daemon/cdemu-daemon.info +++ b/system/cdemu-daemon/cdemu-daemon.info @@ -1,10 +1,10 @@ PRGNAM="cdemu-daemon" -VERSION="1.3.0" +VERSION="1.4.0" HOMEPAGE="http://cdemu.sourceforge.net/pkg_daemon.php" -DOWNLOAD="http://downloads.sourceforge.net/cdemu/cdemu-daemon-1.3.0.tar.gz" -MD5SUM="4ec07bd202ac1dcc2f352fc394268d67" +DOWNLOAD="http://downloads.sourceforge.net/cdemu/cdemu-daemon-1.4.0.tar.gz" +MD5SUM="f7ccc0abc33057d552ec7b0925fce63a" DOWNLOAD_x86_64="" MD5SUM_x86_64="" MAINTAINER="Niels Horn" EMAIL="niels.horn@gmail.com" -APPROVED="pprkut" +APPROVED="Erik Hanson" diff --git a/system/cdemu-daemon/doinst.sh b/system/cdemu-daemon/doinst.sh index f984fef7d7..31fe07a000 100644 --- a/system/cdemu-daemon/doinst.sh +++ b/system/cdemu-daemon/doinst.sh @@ -10,15 +10,18 @@ config() { # 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 +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} -config etc/rc.d/rc.cdemud.new -config etc/rc.d/rc.cdemud.conf.new +preserve_perms etc/rc.d/rc.cdemud.new config etc/dbus-1/system.d/cdemud-dbus.conf.new config etc/udev/rules.d/99-vhba.rules.new diff --git a/system/cdemu-daemon/rc.cdemud b/system/cdemu-daemon/rc.cdemud index c793981c82..e9c7ba08b8 100644 --- a/system/cdemu-daemon/rc.cdemud +++ b/system/cdemu-daemon/rc.cdemud @@ -16,19 +16,17 @@ NAME="cdemud" DESC="cdemu-daemon" -LOCK="/var/lock/${DESC}.lock" +MODULE="vhba" +CTL_DEVICE="/dev/vhba_ctl" 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 + echo "${DESC} is already running at pid: ${PID}" + return ${RETVAL} + exit fi # Load module @@ -36,10 +34,11 @@ start() echo -n "Inserting ${MODULE} kernel module" modprobe "${MODULE}" >/dev/null 2>&1 RETVAL=$? - if [ ${RETVAL} -eq 0 ]; then + if [ ${RETVAL} -eq 0 ]; then echo -e "\t\t\t\t\t[ OK ]\r" else echo -e "\t\t\t\t\t[FAILED]\r" + exit 1 fi fi @@ -59,97 +58,70 @@ start() fi done - if [ ${RETVAL} -eq 0 ]; then + if [ ${RETVAL} -eq 0 ]; then echo -e "\t\t\t\t[ OK ]\r" else echo -e "\t\t\t\t[FAILED]\r" + exit 1 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 + # ... we don't really start the daemon, this is done by dbus 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 - + # Stopping daemon + echo -n "Stopping ${DESC}" + if [ -n "${PID}" ] ;then + kill ${PID} + 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 + sleep 2 + 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} + # 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 + 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} + 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. diff --git a/system/cdemu-daemon/rc.cdemud.conf b/system/cdemu-daemon/rc.cdemud.conf deleted file mode 100644 index aff5ed0a92..0000000000 --- a/system/cdemu-daemon/rc.cdemud.conf +++ /dev/null @@ -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= diff --git a/system/cdemu-daemon/slack-desc b/system/cdemu-daemon/slack-desc index 85285211a6..494593289d 100644 --- a/system/cdemu-daemon/slack-desc +++ b/system/cdemu-daemon/slack-desc @@ -5,7 +5,7 @@ # make exactly 11 lines for the formatting to be correct. It's also # 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: It receives SCSI commands from kernel module and processes them, |