[08/13] gerbera: Add initscript
Commit Message
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
lfs/gerbera | 2 +-
src/initscripts/packages/gerbera | 55 ++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 1 deletion(-)
create mode 100644 src/initscripts/packages/gerbera
Comments
Hello Stefan,
some comments on the initscript:
> + route add -net 239.0.0.0 netmask 255.0.0.0 green0
There is trailing whitespace (a tab) at the end of this line. Also, green0
is hard-coded, and I am not sure what happens when there is no green0 (or
when the user wants this to be offered on blue). Could this use the
interface settings from /var/ipfire/ethernet/settings?
If the route already exists (e.g. after a crash), then "route add" fails
and I do not see any error handling for it, but the script will carry on.
> + loadproc /usr/bin/gerbera -u nobody \
> + -c /etc/gerbera/config.xml \
> + -l /var/log/gerbera.log \
> + -m /var/lib/gerbera \
> + -e green0 $2 $3 $4 $5 $6 $7 -d
The indentation of the last line is mixed (spaces vs. tabs). I am also
wondering whether nobody is able to write to /var/log/gerbera.log, because
nobody cannot create files in /var/log. Did you test this?
Passing $2..$7 to the daemon seems unnecessary. Why do we need that?
> + echo "Usage: ${{0}} {{start|stop|init|status}}"
There is no "init" action and "restart" is missing from this list.
-Michael
@@ -113,7 +113,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
chown nobody:nobody /var/lib/gerbera
#install initscripts
- #$(call INSTALL_INITSCRIPTS,$(SERVICES))
+ $(call INSTALL_INITSCRIPTS,$(SERVICES))
#install backup definition
#install -v -m 644 ${DIR_SRC}/config/backup/includes/minidlna \
new file mode 100644
@@ -0,0 +1,55 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/
+#
+# Description : gerbera initscript
+#
+# Authors : Arne Fitzenreiter
+# Stefan Schantl
+#
+# Version : 01.00
+#
+# Notes : for www.ipfire.org - GPLv3
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "$1" in
+ start)
+ boot_mesg "Starting gerbera uPnP Mediaserver..."
+ route add -net 239.0.0.0 netmask 255.0.0.0 green0
+ loadproc /usr/bin/gerbera -u nobody \
+ -c /etc/gerbera/config.xml \
+ -l /var/log/gerbera.log \
+ -m /var/lib/gerbera \
+ -e green0 $2 $3 $4 $5 $6 $7 -d
+ evaluate_retval
+ ;;
+
+
+ stop)
+ boot_mesg "Stopping gerbera uPnP Mediaserver..."
+ killproc /usr/bin/gerbera
+ evaluate_retval
+ route del -net 239.0.0.0 netmask 255.0.0.0 green0
+ ;;
+
+ restart)
+ ${0} stop
+ sleep 1
+ ${0} start
+
+ ;;
+ status)
+ statusproc /usr/bin/gerbera
+ ;;
+
+ *)
+ echo "Usage: ${0} {start|stop|init|status}"
+ exit 1
+ ;;
+esac
+
+# End $rc_base/init.d/