1 diff --git a/Makefile b/Makefile
2 index d041c66..5b16ded 100644
7 LIBDIR=$(DESTDIR)/usr/lib/edna
8 BINDIR=$(DESTDIR)/usr/bin
9 -INITDIR=$(DESTDIR)/etc/init.d
10 +INITDIR=$(DESTDIR)/etc/rc.d
11 CONFDIR=$(DESTDIR)/etc/edna
14 diff --git a/daemon/edna b/daemon/edna
17 index 4cd0e5f..91870ba
23 # Startup script for the edna mp3 mini server
25 -# chkconfig:2345 97 97
26 -# description: edna is a mini mp3 webserver
28 -# processname: python
29 -# pidfile: /var/run/ednad.pid
32 -# Source function library.
36 -EDNACONF=/etc/edna/edna.conf
37 -PIDFILE=/var/run/edna.pid
41 -pidfile=/var/run/ednad.pid
43 -PYTHON=`which python`
44 -PYTHONPATH=/usr/lib/edna
47 -# Determine which kind of configuration we're using
50 -if [ -f /etc/debian_version ]; then
52 -elif [ -f /etc/redhat-release ]; then
54 -elif [ -f /etc/SuSE-release ]; then
57 - echo "$0: Unknown system, please port" 1>&2
61 +daemon_conf="/etc/$daemon_name/$daemon_name.conf"
62 +daemon_log="/var/log/$daemon_name/$daemon_name.log"
63 +daemon_path=`which $daemon_name`
64 +daemon_pid="/var/run/$daemon_name/$daemon_name.pid"
66 -if [ $system = redhat ]; then
67 - . $initdir/functions
70 +. /etc/rc.d/functions
72 -if [ $system = suse ]; then
76 -[ -f $EDNA ] || exit 0
84 - echo -n "Starting edna: "
85 - startproc -p $PIDFILE $PYTHON $EDNA $EDNACONF >/dev/null 2>&1
89 - echo -n "Shutting down edna: "
90 - killproc -p $PIDFILE $PYTHON $EDNA $EDNACONF >/dev/null 2>&1
94 - echo -n "Checking for service edna: "
95 - checkproc -p $PIDFILE $PYTHON $EDNA $EDNACONF
104 - echo "Usage: $0 {start|stop|status|restart}"
108 + pgrep -f "$daemon_path"
111 -function redhat () {
114 - echo -n "Starting ednad: "
117 - touch /var/lock/subsys/ednad
121 - echo -n "Shutting down ednad: "
123 - EDNADPID=$(cat $pidfile)
126 - rm -f /var/lock/subsys/ednad $pidfile
131 - EDNADPID=$(cat $pidfile)
132 - echo -n "Checking for ednad, PID is : " $EDNADPID
140 - echo "Usage: $0 {start | stop | restart | status}"
145 -function debian () {
148 - echo -n 'Starting edna mp3 server: edna'
149 - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $EDNA -- --daemon $EDNACONF
154 - echo -n 'Stopping edna mp3 server: edna'
155 - start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
160 - start-stop-daemon --stop --signal 1 --oknodo --pidfile $PIDFILE
164 + stat_busy "Starting $daemon_name daemon"
167 + if [ -z "$PID" ]; then
168 + [ -f "$daemon_pid" ] && rm -f "$daemon_pid"
170 + if [ ! -f "$daemon_log" ];then
171 + mkdir /var/log/$daemon_name
174 + chown nobody: $daemon_log
175 + sudo -u nobody $daemon_path --daemon $daemon_conf
177 + if [ $? -gt 0 ]; then
181 + echo $(get_pid) > $daemon_pid
182 + add_daemon $daemon_name
192 + stat_busy "Stopping $daemon_name daemon"
195 + [ ! -z "$PID" ] && kill $PID &> /dev/null
197 + if [ $? -gt 0 ]; then
201 + rm -f $daemon_pid &> /dev/null
202 + rm_daemon $daemon_name
208 - echo -n 'Restarting edna mp3 server: edna'
209 - start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
211 - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $EDNA -- --daemon $EDNACONF
220 + stat_busy "Checking $daemon_name status";
221 + ck_status $daemon_name
225 - echo "Usage: /etc/init.d/edna {start|stop|reload|restart}"
227 + echo "usage: $0 {start|stop|restart|status}"
231 -if [ $system = debian ]; then
233 -elif [ $system = redhat ]; then
235 -elif [ $system = suse ]; then
241 diff --git a/edna.conf b/edna.conf
242 index a535f4a..4500c6c 100644
245 @@ -9,9 +9,9 @@ port = 8080
248 # Where to fine the HTML page templates
249 -# template-dir = templates
250 +template-dir = /usr/lib/edna/templates
251 # Where to find icons
252 -# resource-dir = resources
253 +resource-dir = /usr/lib/edna/resources
255 # Which HTML template to use?
256 # template = default.ezt
257 @@ -38,7 +38,7 @@ zip = 0
259 # log can specify "-" for stdout, or a file name. omitting this line
262 +log = /var/log/edna/edna.log
266 @@ -76,8 +76,8 @@ log = -
267 #dir3 = g:\MP3's = Bob CD
270 -dir1 = /mnt/cdrom = MP3 CDROM
271 -dir2 = /mp3/all-albums = Jukebox
272 +#dir1 = /mnt/cdrom = MP3 CDROM
273 +#dir2 = /mp3/all-albums = Jukebox
277 diff --git a/edna.py b/edna.py
278 index e643a58..cbfeb9e 100755
282 -#!/usr/bin/env python
283 +#!/usr/bin/env python2
285 # edna.py -- an MP3 server
292 +imp.load_source('ezt','/usr/lib/edna/ezt.py')
293 +imp.load_source('MP3Info','/usr/lib/edna/MP3Info.py')
296 import BaseHTTPServer
298 @@ -1162,6 +1166,6 @@ if __name__ == '__main__':
302 - daemonize('/dev/null', '/var/log/edna.log', '/var/log/edna.log', '/var/run/edna.pid')
303 + daemonize('/dev/null', '/var/log/edna/edna.log', '/var/log/edna/edna.log', '/var/run/edna/edna.pid')