#!/bin/sh

#NOTE: if your filesystem is mounted with 'noexec' flag, run this file
#as 
#	sh autorun
#instead of
#	./autorun

#FOR UNIX-like platforms ONLY!!
#autorun script for starting Stunnix Perl Web Server locally and directing 
#user's  browser to the page on the site served by it.
#
#Copyright (c) 2004-2005 by Stunnix company - see http://www.stunnix.com
#for more details.

cd `dirname $0`

PERLLIB=$PERLLIB:`pwd`/perl/common-inc/
export PERLLIB

if [ `uname` = "Linux" ]; then
    if uname -m | grep 86 >/dev/null ; then
	if  perl/linux-x86/perl -v  >/dev/null 2>&1; then
	    exec nohup perl/linux-x86/perl site/stunnixwebsrv/starter.pl \
		site/stunnixwebsrv/startsite.pl $@ </dev/null >/dev/null 2>&1 &
	    exit 0
	fi
    fi
fi

#we are here because there is no prebuilt perl included for OS this 
#script is running under. Let's hope packager #listed all modules in 
#perl/fallback-inc and that system we are running on includes perl
PERLLIB=$PERLLIB:`pwd`/perl/fallback-inc/
export PERLLIB

exec nohup perl site/stunnixwebsrv/startsite.pl $@  </dev/null >/dev/null 2>&1 &
