3 # This file is part of DisOrder
4 # Copyright (C) 2008 Richard Kettlewell
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 echo ------------------------------------------------------------------------
26 echo "DisOrder setup script"
42 echo "This script will:"
43 echo " - overwrite any existing configuration"
46 echo " - set the server up to be run at boot time"
47 echo " - start the server"
51 echo "If this is not what you want, press ^C."
52 echo ------------------------------------------------------------------------
56 echo "What directory or directories contain your music files:"
57 echo "(enter one or more directories separated by spaces)"
60 for root in $roots; do
61 if [ ! -d $root ]; then
62 echo "'$root' does not exist"
71 if [ -z "$encoding" ]; then
73 echo "What filesystem encoding should I assume for track names?"
74 echo "(e.g. UTF-8, ISO-8859-1, ...)"
80 echo "What TCP port should DisOrder listen on?"
81 echo "(enter 'none' for none)"
88 echo "'$port' is not a valid port number"
98 echo "What host should DisOrder use as an SMTP server?"
102 echo "What address should mail from DisOrder come from?"
106 echo "Proposed DisOrder setup:"
107 echo " Music directory: $roots"
108 if [ $port = none ]; then
109 echo " Do not listen on a TCP port"
111 echo " TCP port to listen on: $port"
113 echo " SMTP Server: $smtp_server"
114 echo " Sender address: $mail_sender"
116 echo "Is this OK? (Enter 'y' or 'n')"
123 echo "OK, didn't change anything."
130 rm -f pkgconfdir/config.new
131 for root in $roots; do
132 echo "collection fs $encoding $root" >> pkgconfdir/config.new
134 for scratch in slap.ogg scratch.ogg; do
135 echo "scratch pkgdatadir/$scratch" >> pkgconfdir/config.new
137 echo "user $user" >> pkgconfdir/config.new
138 if [ $port != none ]; then
139 echo "listen 0.0.0.0 $port" >> pkgconfdir/config.new
141 echo "smtp_server $smtp_server" >> pkgconfdir/config.new
142 echo "mail_sender $mail_sender" >> pkgconfdir/config.new
145 echo "Proposed pkgconfdir/config:"
146 sed < pkgconfdir/config.new 's/^/ /'
148 echo "Is this OK? (Enter 'y' or 'n')"
155 echo "OK, not installing it."
156 rm -f pkgconfdir/config.new
161 echo "Installing pkgconfdir/config"
162 mv pkgconfdir/config.new pkgconfdir/config
164 if [ ! -f pkgconfdir/options.user ]; then
165 echo "Making sure pkgconfdir/options.user exists"
166 touch pkgconfdir/options.user
169 echo "Making sure that pkgstatedir exists"
171 chown $user:$group pkgstatedir
172 chmod 2755 pkgstatedir
176 echo "Installing the plist into /Library/LaunchDaemons/"
177 cp server/uk.org.greenend.rjk.disorder.plist /Library/LaunchDaemons/.
178 echo "Reloading launchd"
179 launchctl load /Library/LaunchDaemons
180 echo "Starting DisOrder server"
181 launchctl start uk.org.greenend.rjk.disorder
182 echo "Installing CGI"
183 install -m 555 server/disorder.cgi /Library/WebServer/CGI-Executables/disorder
184 echo "Setting up link to CGI resources"
185 rm /etc/httpd/users/disorder.conf.new
186 echo Alias /disorder/ pkgdatadir/static/ >> /etc/httpd/users/disorder.conf.new
187 mv /etc/httpd/users/disorder.conf.new /etc/httpd/users/disorder.conf
188 echo "Reloading web server"
189 sudo apachectl graceful
191 echo "You must sudo disorder setup-guest [--no-online-registration] next."
194 echo "Sorry, I don't know how to install the server on this platform."
195 echo "You will have to do that by hand."