Search:  
Gentoo Wiki

Rivendell


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

Introduction

This document will briefly describe how to get Salem's open source radio automation software, Rivendell, working on Gentoo Linux.

Requirements

As per the instructions found in the source files, the following is required:

  • X11 Window System (emerge xorg)
  • Qt Toolkit, v3.2 or better (emerge qt)
(either #USE="mysql" emerge qt *or* add "mysql" to the USE= flag in /etc/make.conf)
  • mySQL Database Server (emerge mysql)
(Recommended, unless connecting to a pre-existing database on a remote machine)

Optional

  • GPIO Driver (kernel module for the line of data-acquisition boards from MeasurementComputing.)
  • CDParanoia (emerge cdparanoia) Needed if you want the CD ripper to work.
  • SoX (emerge sox) Needed if you want the CD ripper or sound file importing to work.

Setting up Prerequisites

For now follow the instructions included in the downloads from Salem Radio Labs. For the gentoo packages simply emerging the software should be all that is needed. For mySQL see the mySQL section of Gentoo's Wiki on Apache2 with PHP

Installation

Extracting the archive

Extract the Rivendell package into your source directory.

tar zxvf rivendell-<version number> /usr/src/

Compiling

Configure, make, and install. As root:

cd /usr/src/rivendell-<version number>

./configure

make

make install

If you have errors at this point check to see that all the requirements were met and installed without errors.

You may need to create a symbolic link to librd-*.*.**.so located in /usr/local/lib. You'll know by the error you get saying you need it installed. I don't remember if this needs to be done before or after the install of Rivendell.

ln -sf /usr/local/lib/librd-0.9.16.so /usr/lib/librd-0.9.16.so

Create User Account

Create an account and group that the Rivendell daemon will use. I chose music for both. As root:

adduser music
groupadd music

Don't forget to give your new user a password and verify it:

passwd music

Configuration

Copy and rename the sample configuration file from the source 'conf/' directory to '/etc' . . .

cp conf/rd.conf-sample /etc/rd.conf

. . . and edit it. Under Identity change the username, password, and group name to be the account name you created earlier.

nano -w /etc/rd.conf

Create a directory for your audio sample data:

mkdir /var/snd

This directory should owned, readable and writable by the user and group specified in the 'AudioOwner=' and 'AudioGroup=' entires in '/etc/rd.conf'.

chown music:music /var/snd

File creation

This section requires you to create some files to allow the startups script to run. These files were taken from a Suse 9.2 system and are necessary for the Rivendell package to run. This is probably unconventional and should be revised to be more practical. For now do this:

Create a file in /etc called rc.status

nano -w /etc/rc.status

. . . and add the following code:

# /etc/rc.status
# Definition of boot script return messages
#
#   The bootscripts should use the variables rc_done and rc_failed to
#   report whether they failed or succeeded.  See /etc/init.d/skeleton for
#   an example how the shell functions rc_status and rc_reset are used.
#
#   These functions make use of the variables rc_done and rc_failed;
#   rc_done_up and rc_failed_up are the same as rc_done and rc_failed
#   but contain a terminal code to move up one line before the output
#   of the actual string. (This is particularly useful when the script
#    starts a daemon which produces user output with a newline character)
#
#   The variable rc_reset is used by the master resource control script
#   /etc/init.d/rc to turn off all attributes and switch to the standard
#   character set.
#
#    \033          ascii ESCape
#    \033[<NUM>G   move to column <NUM> (linux console, xterm, not vt100)
#    \033[<NUM>C   move <NUM> columns forward but only upto last column
#    \033[<NUM>D   move <NUM> columns backward but only upto first column
#    \033[<NUM>A   move <NUM> rows up
#    \033[<NUM>B   move <NUM> rows down
#    \033[1m       switch on bold
#    \033[31m      switch on red
#    \033[32m      switch on green
#    \033[33m      switch on yellow
#    \033[m        switch off color/bold
#    \017          exit alternate mode (xterm, vt100, linux console)
#    \033[10m      exit alternate mode (linux console)
#    \015          carriage return (without newline)
#

if test -z "$LINES" -o -z "$COLUMNS" ; then
    eval `exec 3<&1; stty size <&3 2>/dev/null | (read L C; \
	  echo LINES=${L:-24} COLUMNS=${C:-80})`
fi
test $LINES   -eq 0 && LINES=24
test $COLUMNS -eq 0 && COLUMNS=80
export LINES COLUMNS

# Make sure we have /sbin and /usr/sbin in PATH
case $PATH in
	*sbin*)
		;;
	*)
		export PATH=/sbin:/usr/sbin:$PATH
		;;
esac

if test -t 1 -a "$TERM" != "raw" -a "$TERM" != "dumb" && stty size <&1 > /dev/null 2>&1 ; then
	 esc=`echo -en "\033"`
        extd="${esc}[1m"
        warn="${esc}[1;31m"
        done="${esc}[1;32m"
        attn="${esc}[1;33m"
        norm=`echo -en "${esc}[m\017"`
        stat=`echo -en "\015${esc}[${COLUMNS}C${esc}[10D"`

     rc_done="${stat}${done}done${norm}"
  rc_running="${stat}${done}running${norm}"
   rc_failed="${stat}${warn}failed${norm}"
   rc_missed="${stat}${warn}missing${norm}"
  rc_skipped="${stat}${attn}skipped${norm}"
     rc_dead="${stat}${warn}dead${norm}"
   rc_unused="${stat}${extd}unused${norm}"
  rc_unknown="${stat}${attn}unknown${norm}"
  rc_done_up="${esc}[1A${rc_done}"
rc_failed_up="${esc}[1A${rc_failed}"
    rc_reset="${norm}${esc}[?25h"
     rc_save="${esc}7${esc}[?25l"
  rc_restore="${esc}8${esc}[?25h"
    function rc_cuu () { test $1 -eq 0 && return; echo -en "\033[${1}A"; }
    function rc_cud () { test $1 -eq 0 && return; echo -en "\033[${1}B"; }
    function rc_timer_on () {
	# Draw seconds of running timout to column.
	# Two arguments: timeout in seconds and offset
	local n=$1
	local c=$2
	(trap "exit 0" SIGTERM
	 while test $((n--)) -gt 0; do
	    sleep 1;
	    if test $n -gt 9 ; then
		echo -en "\015${esc}[${c}C(${n}s) "
	    else
		echo -en "\015${esc}[${c}C( ${n}s) "
	    fi
	done) & _rc_timer_pid=$!
    }
    function rc_timer_off () {
	if test -n "$_rc_timer_pid" ; then
	    kill -SIGTERM $_rc_timer_pid > /dev/null 2>&1
	fi
	unset _rc_timer_pid
    }
else
	 esc=""
        extd=""
        warn=""
        done=""
        attn=""
        norm=""
        stat=""

     rc_done="..done"
  rc_running="..running"
   rc_failed="..failed"
   rc_missed="..missing"
  rc_skipped="..skipped"
     rc_dead="..dead"
   rc_unused="..unused"
  rc_unknown="..unknown"
  rc_done_up="${rc_done}"
rc_failed_up="${rc_failed}"
    rc_reset=""
     rc_save=""
  rc_restore=""
    function rc_cuu () { return; }
    function rc_cud () { return; }
    function rc_timer_on  () { return; }
    function rc_timer_off () { return; }
fi

_rc_service=${0##*/[SK][0-9][0-9]}
_rc_status=0
_rc_status_all=0
_rc_todo=$1
function rc_check ()
{
    _rc_status_ret=$?
    test $_rc_status_ret -eq 0 || _rc_status=$_rc_status_ret
    test $_rc_status     -eq 0 || _rc_status_all=$_rc_status
    return $_rc_check_ret
}
function rc_reset ()
{
    _rc_status=0
    _rc_status_all=0
    rc_check
    return 0
}

if   test "$_rc_todo" = "status" ; then
function rc_status ()
{
    rc_check
    _rc_status_ret=$_rc_status
    local i
    for i ; do
	case "$i" in
	-v|-v[1-9]|-v[1-9][0-9])
	    local vrt=""
	    local out=1
	    local opt="en"

	    test -n "${i#-v}" && vrt="$vrt${esc}[${i#-v}A" || opt="e"
	    case "$_rc_status" in
	    0)	vrt="$vrt$rc_running";		;; # service running
	    1)	vrt="$vrt$rc_dead"   ; out=2	;; # service dead (but has pid file)
	    2)	vrt="$vrt$rc_dead"   ; out=2	;; # service dead (but has lock file)
	    3)	vrt="$vrt$rc_unused" ;		;; # service not running
	    4)	vrt="$vrt$rc_unknown";		;; # status is unknown
	    esac
	    echo -$opt "$rc_save$vrt$rc_restore" 1>&$out

	    # reset _rc_status to 0 after verbose case
	    _rc_status=0 ;;
	-r) rc_reset ;;
	-s) echo -e "$rc_skipped" ; rc_failed 3 ;;
	-u) echo -e "$rc_unused"  ; rc_failed 3 ;;
	*)  echo "rc_status: Usage: [-v[<num>] [-r]|-s|-u]" 1>&2 ; return 0 ;;
	esac
    done
    return $_rc_status_ret
}
elif test -n "$_rc_todo" ; then
function rc_status ()
{
    rc_check
    test "$_rc_status" -gt 7 && rc_failed 1
    _rc_status_ret=$_rc_status
    case "$_rc_todo" in
    stop)
	# program is not running which
	# is success if we stop service
	test "$_rc_status" -eq 7 && rc_failed 0 ;;
    esac
    local i
    for i ; do
	case "$i" in
	-v|-v[1-9]|-v[1-9][0-9])
	    local vrt=""
	    local out=1
	    local opt="en"

	    test -n "${i#-v}" && vrt="$vrt${esc}[${i#-v}A" || opt="e"
	    case "$_rc_status" in
	    0)	vrt="$vrt$rc_done"   ;		;; # success
	    1)	vrt="$vrt$rc_failed" ; out=2	;; # generic or unspecified error
	    2)	vrt="$vrt$rc_failed" ; out=2	;; # invalid or excess args
	    3)	vrt="$vrt$rc_missed" ; out=2	;; # unimplemented feature
	    4)	vrt="$vrt$rc_failed" ; out=2	;; # insufficient privilege
	    5)	vrt="$vrt$rc_skipped"; out=2	;; # program is not installed
	    6)	vrt="$vrt$rc_unused" ; out=2	;; # program is not configured
	    7)	vrt="$vrt$rc_failed" ; out=2	;; # program is not running
	    *)	vrt="$vrt$rc_failed" ; out=2	;; # unknown (maybe used in future)
	    esac
	    echo -$opt "$rc_save$vrt$rc_restore" 1>&$out

	    # reset _rc_status to 0 after verbose case
	    _rc_status=0 ;;
	-r) rc_reset ;;
	-s) echo -e "$rc_skipped" 1>&2 ; rc_failed 5 ;;
	-u) echo -e "$rc_unused"  1>&2 ; rc_failed 6 ;;
	*)  echo "rc_status: Usage: [-v[<num>] [-r]|-s|-u]" 1>&2 ; return 0 ;;
	esac
    done
    return $_rc_status_ret
}
else
function rc_status ()
{
    rc_check
    _rc_status_ret=$_rc_status
    local i
    for i ; do
	case "$i" in
	-v|-v[1-9]|-v[1-9][0-9])
	    local vrt=""
	    local out=1
	    local opt="en"

	    test -n "${i#-v}" && vrt="$vrt${esc}[${i#-v}A" || opt="e"
	    case "$_rc_status" in
	    0)	vrt="$vrt$rc_done"  ;		;; # success
	    *)	vrt="$vrt$rc_failed"; out=2	;; # failed
	    esac
	    echo -$opt "$rc_save$vrt$rc_restore" 1>&$out

	    # reset _rc_status to 0 after verbose case
	    _rc_status=0 ;;
	-r) rc_reset ;;
	-s) echo -e "$rc_skipped"  ; return 0 ;;
	-u) echo -e "$rc_unused"   ; return 0 ;;
	*)  echo "rc_status: Usage: [-v[<num>] [-r]|-s|-u]" 1>&2 ; return 0 ;;
	esac
    done
    return $_rc_status_ret
}
fi

function rc_failed ()
{
    rc_reset
    case "$1" in
    [0-7]) _rc_status=$1 ;;
    "")    _rc_status=1
    esac
    rc_check
    return $_rc_status
}

function rc_exit ()
{
    exit $_rc_status_all
}

function rc_confirm()
{
    local timeout="30"
    local answer=""
    local ret=0

    case "$1" in
    -t) timeout=$2; shift 2 ;;
    esac
    local message="$@, (Y)es/(N)o/(C)ontinue? [y] "
    : ${REDIRECT:=/dev/tty}

    while true ; do
	read -t ${timeout} -n 1 -p "${message}" answer < $REDIRECT > $REDIRECT 2>&1
	case "$answer" in
	[yY]|"") ret=0; break ;;
	[nN])	 ret=1; break ;;
	[cC])	 ret=2; break ;;
	*)	 echo; continue
	esac
    done
    echo
    return $ret
}

function rc_active ()
{
    local x
    for x in /etc/init.d/*.d/S[0-9][0-9]${1} ; do
	test -e $x || break
	return 0
    done
    return 1
}

function rc_splash()
{
    return 0
}

Now create another file /lib/lsb/init-functions (you may have to create a /lib/lsb directory)

mkdir /lib/lsb
nano -w /lib/lsb/init-functions

. . . and add the following:

#
# Define init LSB shell functions
#

#
# Source SuSE's rc functions
#
. /etc/rc.status

#
# Be sure that  start_daemon, killproc, and
# pidofproc will be script functions.
#
function start_daemon ()
{
    /sbin/start_daemon ${1+"$@"}
}

function killproc ()
{
    /sbin/killproc ${1+"$@"}
}

function pidofproc ()
{
    /sbin/pidofproc ${1+"$@"}
}

#
# Logging of succes messages
#
function log_success_msg ()
{
    echo -en "$@"
    echo -e  "$rc_done"
}

#
# Logging of failure messages
#
function log_failure_msg ()
{
    echo -en "$@"
    echo -e  "$rc_failed"
}

#
# Logging of warn messages
#
function log_warning_msg ()
{
    echo -en "$@"
    echo -e  "${stat}${attn} warning${norm}"
}


Make these files readable.

chmod 666 /etc/rc.status
chmod 666 /lib/lsb/init-functions

Starting up

Finally, it's time to start things up. Run 'rdadmin' from a shell prompt.

rdadmin

For the first time startup, RDAdmin will prompt for a login name/password on the mySQL server so that it can create the Rivendell database. RDadmin creates a user rduser with the correct permissions as well. With phpmyadmin or mysql-adminitsrator I changed the password of this user and added in rd.conf a mysql section:

[mySQL]
 Hostname=localhost
 Loginname=rduser
 Password=your password
 Database=Rivendell

Remember that you have to reload the permission tables, so that mysql accepts the new password. If you dont know how it is done, restart the mysql daemon.

Once this has been done, and the main menu appears, be sure to go into 'Manage Stations' and create an entry for the current workstation.


Much of the work in Rivendell gets done by three daemon processes, named 'caed', 'ripcd' and 'rdcatchd'. These daemons *must* be running before attempting to start any of the Rivendell applications. The order in which they are started is important, and should be the same as the order in which they are listed above. For convienence, a Sys-V style init script called 'rivendell' that can start, stop and restart the daemons properly is installed in '/etc/init.d/'

To start the daemon:

/etc/init.d/rivendell start

To add it to the startup scripts:

rc-update add rivendell default

Resources

Retrieved from "http://www.gentoo-wiki.info/Rivendell"

Last modified: Thu, 04 Sep 2008 05:44:00 +0000 Hits: 13,705