#! /bin/sh

#
# NAME
#	whatsnew - give new users overview of new tools, apps, functionality
#
# SYNOPSIS
#	whatsnew
#
# DESCRIPTION
#	This firsttime script is used in conjunction with the
#	/usr/lib/X11/xdm/Xsession.dt desktop script for starting up the
#	whatsnew presentation that is run the first time each user logs
#	into their workstation.
#
#	Sequence of actions
#		- bring up whatsnew product overview/tutorial
#		- iconbook has already been started by Xsession.dt and
#			the correct page selected by EditXsessiondtWN
#
# COPYRIGHT (C) 1995, Silicon Graphics Inc. All Rights Reserved
#
if test x${LANG}x = xx; then LANG=en_US; fi
if test x${LANG}x = xCx; then LANG=en_US; fi
if test ! -r /var/www/htdocs/WhatsNew/data/$LANG; then LANG=en_US; fi

echo $LANG > /var/www/htdocs/WhatsNew/data/lang
echo $USER > /var/www/htdocs/WhatsNew/data/user

# Don't proceed with whatsnew execution for root,  -Lance.
# could test root = `whoami`, `id`, or `logname` or $USER (not euid)
if test $USER = root
then
	exit
fi

# Select the WhatsNew language according to our language determination above. At this
# point, $LANG is guaranteed to exist. We always start with a "base" of US English

cp -p /var/www/htdocs/WhatsNew/data/en_US/* /var/www/htdocs/WhatsNew/data
cp -p /var/www/htdocs/WhatsNew/data/$LANG/* /var/www/htdocs/WhatsNew/data

# 
# Test to see if any of the Netscape servers installed.
# If so, present file:/usr/local/lib/netscape/docs/Welcome.html
# instead of http://localhost/WhatsNew/whatsnew.cgi since
# the latter requires a configured HTTP server.
# 

OVERVIEW=http://localhost:8778/WhatsNew/whatsnew.cgi
OVERVIEWFILE=/var/www/htdocs/WhatsNew/whatsnew.cgi

# Make sure this First Time program is always executed by removing the checkfile
host=`hostname`
dotdesktop=.desktop-$host
configchecks=$HOME/$dotdesktop/configchecks
checkfile=$configchecks/`basename $0`
rm -f $checkfile
if test -r /var/www/htdocs/WhatsNew/regquery.sh
	then
	if /var/www/htdocs/WhatsNew/regquery.sh
		then
		(echo "1" > $checkfile)
		exit
	fi
fi

# Launch the viewer
if test -r $OVERVIEWFILE
then
	if test -n "$WEBBROWSER"
	then
		browser="$WEBBROWSER"
	elif test -x /usr/bin/X11/netscape
	then
		browser=/usr/bin/X11/netscape
	elif test -x /usr/bin/X11/xmosaic
	then
		browser=/usr/bin/X11/xmosaic
	fi
	$browser $OVERVIEW &
fi

# Run OutBox's WebServer
NEWUSER=/var/www/server/addUser.sh
if test -x $NEWUSER
then
	$NEWUSER $* &
fi

