#!/bin/sh # Install script for the Darwin Streaming Server # source release. # # Modifications: (October 2003, John Gilbert - ) # 1. Removed the need to be root to install # 2. Setup installation to put all files into a single directory # 3. Fixed path to AdminHtml directory # 4. Fixed paths to binaries (new makefiles are in the respective project directories) # echo;echo Installing Darwin Streaming Server;echo echo Checking for and Killing currently running Darwin Streaming Server if [ `uname` = "FreeBSD" ]; then ps -ax | awk '/DarwinStreamingServer/ {print $1}' | xargs kill -9 ps -ax | awk '/streamingadminserver.pl/ {print $1}' | xargs kill -9 fi if [ `uname` = "Linux" ]; then ps -ax | awk '{print $1" " $5}' | awk '/DarwinStreamingServer/ {print $1}' | xargs -r kill -9 ps -ax | awk '/streamingadminserver.pl/ {print $1}' | xargs -r kill -9 fi if [ `uname` = "SunOS" ]; then ps -aef | awk '/DarwinStreamingServer/ {print $2}' | xargs -n 2 kill -9 ps -aef | awk '/streamingadminserver.pl/ {print $2}' | xargs -n 1 kill -9 fi ## REMOVED OLD VERSION ## echo Removing previous versions of Darwin Streaming Server if [ -f /home/jgilbert/darwin/sbin/DarwinStreamingServer ]; then echo removing /home/jgilbert/darwin/sbin/DarwinStreamingServer rm -f /home/jgilbert/darwin/sbin/DarwinStreamingServer fi if [ -f /home/jgilbert/darwin/bin/PlaylistBroadcaster ]; then echo removing /home/jgilbert/darwin/bin/PlaylistBroadcaster rm -f /home/jgilbert/darwin/bin/PlaylistBroadcaster fi if [ -f /home/jgilbert/darwin/bin/MP3Broadcaster ]; then echo removing /home/jgilbert/darwin/bin/MP3Broadcaster rm -f /home/jgilbert/darwin/bin/MP3Broadcaster fi if [ -f /home/jgilbert/darwin/bin/qtpasswd ]; then echo removing /home/jgilbert/darwin/bin/qtpasswd rm -f /home/jgilbert/darwin/bin/qtpasswd fi if [ -f /home/jgilbert/darwin/sbin/streamingadminserver.pl ]; then echo removing /home/jgilbert/darwin/sbin/streamingadminserver.pl rm -f /home/jgilbert/darwin/sbin/streamingadminserver.pl fi echo ## BACKUP OLD CONFIG FILES ## echo Backing up previous config files if [ -f /home/jgilbert/darwin/etc/streamingserver.xml ]; then echo backing up /home/jgilbert/darwin/etc/streamingserver.xml to /home/jgilbert/darwin/etc/streamingserver.xml.backup mv /home/jgilbert/darwin/etc/streamingserver.xml /home/jgilbert/darwin/etc/streamingserver.xml.backup fi if [ -f /home/jgilbert/darwin/etc/streamingadminserver.pem ]; then echo backing up /home/jgilbert/darwin/etc/streamingadminserver.pem to /home/jgilbert/darwin/etc/streamingadminserver.pem.backup mv /home/jgilbert/darwin/etc/streamingadminserver.pem /home/jgilbert/darwin/etc/streamingadminserver.pem.backup fi if [ -f /home/jgilbert/darwin/etc/qtusers ]; then echo backing up /home/jgilbert/darwin/etc/qtusers to /home/jgilbert/darwin/etc/qtusers.backup mv /home/jgilbert/darwin/etc/qtusers /home/jgilbert/darwin/etc/qtusers.backup fi if [ -f /home/jgilbert/darwin/etc/qtgroups ]; then echo backing up /home/jgilbert/darwin/etc/qtgroups to /home/jgilbert/darwin/etc/qtgroups.backup mv /home/jgilbert/darwin/etc/qtgroups /home/jgilbert/darwin/etc/qtgroups.backup fi if [ -f /home/jgilbert/darwin/etc/streamingloadtool.conf ]; then echo backing up /home/jgilbert/darwin/etc/streamingloadtool.conf to /home/jgilbert/darwin/etc/streamingloadtool.conf.backup mv /home/jgilbert/darwin/etc/streamingloadtool.conf /home/jgilbert/darwin/etc/streamingloadtool.conf.backup fi if [ -f /home/jgilbert/darwin/etc/relayconfig.xml ]; then echo backing up /home/jgilbert/darwin/etc/relayconfig.xml to /home/jgilbert/darwin/etc/relayconfig.xml.backup mv /home/jgilbert/darwin/etc/relayconfig.xml /home/jgilbert/darwin/etc/relayconfig.xml.backup fi echo ## CHANGE PERL PATH IN streamingadminserver.pl AND parse_xml.cgi ## # Look for perl in the default locations if [ -x /usr/bin/perl ]; then perldef=/usr/bin/perl elif [ -x /usr/local/bin/perl ]; then perldef=/usr/local/bin/perl else perldef="" fi # Test if it is really perl $perldef -e 'print "foobar\n"' 2>/dev/null | grep foobar >/dev/null # if it isn't really perl if [ $? != "0" ]; then # prompt the user to enter the path to perl if [ "$perl" = "" ]; then if [ "$perldef" = "" ]; then printf "Full path to perl: " read perl if [ "$perl" = "" ]; then echo "ERROR: No path entered!" echo "" exit 4 fi else printf "Full path to perl (default $perldef): " read perl if [ "$perl" = "" ]; then perl=$perldef fi fi fi echo "" # Test perl echo "Testing Perl ..." if [ ! -x $perl ]; then echo "ERROR: Failed to find perl at $perl" echo "" exit 1 fi $perl -e 'print "foobar\n"' 2>/dev/null | grep foobar >/dev/null if [ $? != "0" ]; then echo "ERROR: Failed to run test perl script. Maybe $perl is" echo "not the perl interpreter, or is not installed properly" echo "" exit 1 fi $perl -e 'exit ($] < 5.002 ? 1 : 0)' if [ $? = "1" ]; then echo "ERROR: Detected old perl version. The streaming server admin requires" echo "perl 5.002 or better to run" echo "" exit 1 fi else if [ "$perl" = "" ]; then perl=$perldef fi fi if [ "$noperlpath" = "" ]; then echo "Inserting path to perl into scripts.." $perl WebAdmin/perlpath.pl $perl WebAdmin/src/streamingadminserver.pl WebAdmin/AdminHtml/parse_xml.cgi echo "" fi ## INSTALL NEW VERSION ## if [ ! -d /home/jgilbert/darwin/sbin ]; then echo creating "/home/jgilbert/darwin/sbin" directory mkdir -p /home/jgilbert/darwin/sbin fi if [ ! -d /home/jgilbert/darwin/bin ]; then echo creating "/home/jgilbert/darwin/bin" directory mkdir -p /home/jgilbert/darwin/bin fi echo copying "DarwinStreamingServer" to "/home/jgilbert/darwin/sbin/DarwinStreamingServer" cp -f DarwinStreamingServer /home/jgilbert/darwin/sbin/ echo copying "PlaylistBroadcaster" to "/home/jgilbert/darwin/bin/PlaylistBroadcaster" cp -f PlaylistBroadcaster.tproj/PlaylistBroadcaster /home/jgilbert/darwin/bin/ echo copying "MP3Broadcaster" to "/home/jgilbert/darwin/bin/MP3Broadcaster" cp -f MP3Broadcaster/MP3Broadcaster /home/jgilbert/darwin/bin/ echo copying "qtpasswd" to "/home/jgilbert/darwin/bin/qtpasswd" cp -f qtpasswd.tproj/qtpasswd /home/jgilbert/darwin/bin/ # For now, do not copy modules as there are no supported dynamic modules # echo copying modules to "/home/jgilbert/darwin/sbin/StreamingServerModules" if [ ! -d /home/jgilbert/darwin/sbin/StreamingServerModules ]; then echo creating "/home/jgilbert/darwin/sbin/StreamingServerModules" directory mkdir /home/jgilbert/darwin/sbin/StreamingServerModules fi # cp -f StreamingServerModules/* /home/jgilbert/darwin/sbin/StreamingServerModules/ if [ ! -d /home/jgilbert/darwin/etc ]; then echo creating "/home/jgilbert/darwin/etc" directory mkdir -p /home/jgilbert/darwin/etc fi echo copying "streamingserver.xml" to "/home/jgilbert/darwin/etc/streamingserver.xml-sample" cp -f streamingserver.xml /home/jgilbert/darwin/etc/streamingserver.xml-sample echo;echo copying "streamingserver.xml" to "/home/jgilbert/darwin/etc/streamingserver.xml" cp -f streamingserver.xml /home/jgilbert/darwin/etc/streamingserver.xml chmod 600 /home/jgilbert/darwin/etc/streamingserver.xml echo;echo copying "relayconfig.xml-Sample" to "/home/jgilbert/darwin/etc/relayconfig.xml-Sample" cp -f relayconfig.xml-Sample /home/jgilbert/darwin/etc/relayconfig.xml-Sample chmod 600 /home/jgilbert/darwin/etc/relayconfig.xml-Sample echo;echo copying "qtusers" to "/home/jgilbert/darwin/etc/qtusers" cp -f qtusers /home/jgilbert/darwin/etc/qtusers chmod 600 /home/jgilbert/darwin/etc/qtusers echo;echo copying "qtgroups" to "/home/jgilbert/darwin/etc/qtgroups" cp -f qtgroups /home/jgilbert/darwin/etc/qtgroups chmod 600 /home/jgilbert/darwin/etc/qtgroups if [ ! -d /home/jgilbert/darwin/var ]; then echo creating "/home/jgilbert/darwin/var" directory mkdir -p /home/jgilbert/darwin/var fi if [ ! -d /home/jgilbert/darwin/var/logs ]; then echo creating "/home/jgilbert/darwin/var/logs" directory mkdir -p /home/jgilbert/darwin/var/logs fi if [ ! -d /home/jgilbert/darwin/movies ]; then echo creating "/home/jgilbert/darwin/movies" directory mkdir -p /home/jgilbert/darwin/movies fi if [ ! -d /home/jgilbert/darwin/var/playlists ]; then echo creating "/home/jgilbert/darwin/var/playlists" directory mkdir -p /home/jgilbert/darwin/var/playlists chmod 777 /home/jgilbert/darwin/var/playlists fi echo copying "sample_100kbit.mov" into "/home/jgilbert/darwin/movies/sample_100kbit.mov" cp -f sample_100kbit.mov /home/jgilbert/darwin/movies/ echo copying "sample_300kbit.mov" into "/home/jgilbert/darwin/movies/sample_300kbit.mov" cp -f sample_300kbit.mov /home/jgilbert/darwin/movies/ echo copying "sample_100kbit.mp4" into "/home/jgilbert/darwin/movies/sample_100kbit.mp4" cp -f sample_100kbit.mp4 /home/jgilbert/darwin/movies/ echo copying "sample_300kbit.mp4" into "/home/jgilbert/darwin/movies/sample_300kbit.mp4" cp -f sample_300kbit.mp4 /home/jgilbert/darwin/movies/ echo copying "sample.mp3" into "/home/jgilbert/darwin/movies/sample.mp3" cp -f sample.mp3 /home/jgilbert/darwin/movies/ # # Doesnt seem to the a streaming load tool in this source distribution! # echo copying "StreamingLoadTool" to "/home/jgilbert/darwin/bin/StreamingLoadTool" # cp -f StreamingLoadTool /home/jgilbert/darwin/bin/ # echo copying "streamingloadtool.conf" to "/home/jgilbert/darwin/etc/streamingloadtool.conf" # cp -f streamingloadtool.conf /home/jgilbert/darwin/etc/ # # WebAdmin install echo copying "streamingadminserver.pl" into "/home/jgilbert/darwin/sbin/streamingadminserver.pl" cp -f WebAdmin/src/streamingadminserver.pl /home/jgilbert/darwin/sbin/streamingadminserver.pl echo copying "adminserver_onedirectory.conf" into "/home/jgilbert/darwin/etc/adminserver_onedirectory.conf" cp -f WebAdmin/adminserver_onedirectory.conf /home/jgilbert/darwin/etc/adminserver_onedirectory.conf if [ -d /home/jgilbert/darwin/var/AdminHtml/ ]; then echo removing old version of html from "/home/jgilbert/darwin/var/AdminHtml" rm -r -f /home/jgilbert/darwin/var/AdminHtml/* fi if [ ! -d /home/jgilbert/darwin/var/ ]; then echo creating "/home/jgilbert/darwin/var/AdminHtml" directory mkdir -p /home/jgilbert/darwin/var/AdminHtml fi echo copying Admin HTML to "/home/jgilbert/darwin/var/AdminHtml" directory cp -f -r WebAdmin/AdminHtml /home/jgilbert/darwin/var/ # Lets not do this for the moment.. # echo;echo "Launching streamingadminserver.pl" # /home/jgilbert/darwin/sbin/streamingadminserver.pl echo;echo Installation Complete