X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/3b8ce6f62deaf835311cd63ad675bea7013c91ff..985bb670b4e07d35cb1580780253ded2524a342e:/scripts/setup.in
diff --git a/scripts/setup.in b/scripts/setup.in
index e89ddb4..b7fdecd 100755
--- a/scripts/setup.in
+++ b/scripts/setup.in
@@ -3,20 +3,18 @@
# This file is part of DisOrder
# Copyright (C) 2008 Richard Kettlewell
#
-# This program is free software; you can redistribute it and/or modify
+# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
+# along with this program. If not, see .
#
set -e
@@ -27,6 +25,7 @@ while [ $# -gt 0 ]; do
case "$opt" in
-h | --help )
cat <&2 "ERROR: unknown option '$opt'"
exit 1
@@ -129,23 +149,31 @@ if [ -z "$roots" ]; then
echo "(enter one or more directories separated by spaces)"
read -r roots
ok=true
+ anyroots=false
for root in $roots; do
if [ ! -d $root ]; then
echo "'$root' does not exist"
ok=false
+ else
+ anyroots=true
fi
done
- if $ok; then
+ if $anyroots && $ok; then
break
fi
done
fi
if [ -z "$encoding" ]; then
- echo
- echo "What filesystem encoding should I assume for track names?"
- echo "(e.g. UTF-8, ISO-8859-1, ...)"
- read -r encoding
+ while :; do
+ echo
+ echo "What filesystem encoding should I assume for track names?"
+ echo "(e.g. UTF-8, ISO-8859-1, ...)"
+ read -r encoding
+ if [ ! -z "$encoding" ]; then
+ break
+ fi
+ done
fi
if [ -z "$port" ]; then
@@ -158,7 +186,7 @@ if [ -z "$port" ]; then
none )
break
;;
- [^0-9] )
+ [^0-9] | "" )
echo "'$port' is not a valid port number"
continue
;;
@@ -169,10 +197,50 @@ if [ -z "$port" ]; then
done
fi
-if [ -z "$smtp_server" ]; then
- echo
- echo "What host should DisOrder use as an SMTP server?"
- read -r smtp_server
+if [ -z "$play" ]; then
+ while :; do
+ echo
+ echo "How do you want to play sound? Enter 'local' to use a local sound"
+ echo "device or 'network' to multicast sound across your network."
+ read -r play
+ case $play in
+ 'local' | network )
+ break
+ ;;
+ * )
+ echo "Enter 'local' or 'network'"
+ continue
+ ;;
+ esac
+ done
+fi
+
+if [ "x$play" = xnetwork ]; then
+ if [ -z "$mcast_address" ]; then
+ echo
+ echo "Enter destination address for network transmission"
+ echo "(e.g. a multicast address)"
+ read -r mcast_address
+ fi
+ if [ -z "$mcast_port" ]; then
+ while :; do
+ echo
+ echo "Enter destination port for network transmission"
+ read -r mcast_port
+ case $mcast_port in
+ none )
+ break
+ ;;
+ [^0-9] | "" )
+ echo "'$mcast_port' is not a valid port number"
+ continue
+ ;;
+ * )
+ break
+ ;;
+ esac
+ done
+ fi
fi
if [ -z "$mail_sender" ]; then
@@ -196,7 +264,7 @@ if [ -z "$register" ]; then
echo
echo "Do you want to enable online registration? (Enter 'y' or 'n')"
read -r register
- case $reguser in
+ case $register in
y | n )
break
;;
@@ -207,14 +275,19 @@ fi
echo
echo "Proposed DisOrder setup:"
echo " Music directory: $roots"
-if [ $port = none ]; then
+if [ "$port" = none ]; then
echo " Do not listen on a TCP port"
else
echo " TCP port to listen on: $port"
fi
-echo " SMTP Server: $smtp_server"
+if [ ! -z "$smtp_server" ]; then
+ echo " SMTP Server: $smtp_server"
+fi
echo " Sender address: $mail_sender"
echo " Online registration: $register"
+if [ $play = network ]; then
+ echo " Send sound to: $mcast_address port $mcast_port"
+fi
echo "Is this OK? (Enter 'y' or 'n')"
read -r ok
@@ -241,7 +314,12 @@ echo "user $user" >> pkgconfdir/config.new
if [ $port != none ]; then
echo "listen 0.0.0.0 $port" >> pkgconfdir/config.new
fi
-echo "smtp_server $smtp_server" >> pkgconfdir/config.new
+if [ $play = network ]; then
+ echo "broadcast $mcast_address $mcast_port" >> pkgconfdir/config.new
+fi
+if [ ! -z "$smtp_server" ]; then
+ echo "smtp_server $smtp_server" >> pkgconfdir/config.new
+fi
echo "mail_sender $mail_sender" >> pkgconfdir/config.new
echo
@@ -365,36 +443,13 @@ Mac )
launchctl load /Library/LaunchDaemons
echo "Starting DisOrder server"
launchctl start uk.org.greenend.rjk.disorder
- CGIBIN=/Library/WebServer/CGI-Executables
- DOCROOT=/Library/WebServer/Documents
- sever_running=true
+ server_running=true
;;
FreeBSD )
echo "Installing startup script into /etc/rc.d"
install -m 555 examples/disorder.rc /etc/rc.d/disorder
echo "Starting DisOrder server"
/etc/rc.d/disorder start
- echo "Identifying web server"
- set /usr/local/www/*
- case $# in
- 0 )
- echo
- echo "Could not find a web server"
- exit 1
- ;;
- 1 )
- ;;
- * )
- echo
- echo "Yikes! There seems to be more than one web server here."
- echo "Guessing that you want $1."
- echo
- ;;
- esac
- web=$1
- echo "Found $web"
- CGIBIN=$web/cgi-bin
- DOCROOT=$web/data
server_running=true
;;
Linux )
@@ -424,20 +479,6 @@ Linux )
echo "Starting DisOrder server"
$RC_D/init.d/disorder start
fi
- echo "Looking for web server document root"
- for d in /var/www/html /var/www; do
- if [ -d $d ]; then
- DOCROOT=$d
- break
- fi
- done
- echo "Looking for cgi-bin directory"
- for d in /var/www/cgi-bin /usr/lib/cgi-bin; do
- if [ -d $d ]; then
- CGIBIN=$d
- break
- fi
- done
server_running=true
;;
* )
@@ -448,23 +489,6 @@ Linux )
;;
esac
-echo
-if [ -z "$DOCROOT" ]; then
- echo "Cannot find your web server's document root"
-else
- echo "Setting up link to CGI's dependencies in $DOCROOT"
- rm -f $DOCROOT/disorder
- ln -s pkgdatadir/static $DOCROOT/disorder
-fi
-
-echo
-if [ -z "$CGIBIN" ]; then
- echo "Cannot find your web server's cgi-bin directory"
-else
- echo "Installing CGI in $CGIBIN"
- install -m 555 server/disorder.cgi $CGIBIN/disorder
-fi
-
if $server_running; then
first=true
sleep 5