#!/bin/sh
#
# See if we have to use the lame SYS-V echo command flags.
#
echo ''
echo '=================================================================='
echo '       Communicator 4.8 [muriyari-ja] ܸĶ   '
echo '       Copyright (c) 1997 by Netscape Communications Corp.'
echo '       Copyright (c) 1998 - 2001 by egota@linet.gr.jp'
echo '=================================================================='
echo ''
# Modified[4.77]: egota <egota@linet.gr.jp>, 25-Apr-2001
# Modified[4.78]: egota <egota@linet.gr.jp>, 25-Jun-2001
version=-v48

#localized="C"
localized=""
if [ "x$LANG" != "x" -a "$LANG" != "xC" ] ; then
    localized=$LANG
fi
LOC_LANG=localized

MOZILLA_HOME=/usr/lib/netscape${version}/$localized
XFILESEARCHPATH=${MOZILLA_HOME}/%N:/usr/X11R6/lib/X11/%L/%T/%N:/usr/X11R6/lib/X11/%T/%N
export MOZILLA_HOME XFILESEARCHPATH

# If you are FreeBSD user, get libansi.so.1.2 and uncomment below may help you. 
#if [ x$LANG != x -a $LANG != C ] ; then
#    export LD_PRELOAD=libxpg4.so.2.0:${MOZILLA_HOME}/libansi.so.1.2
#fi

# MIRACLE Linux User setting.
if [ -d /usr/src/rpm ]; then
    if [ ! -f /tmp/nc${version} ]; then
	cp /usr/lib/netscape${version}/$localized/MIRACLE/bookmark.htm /usr/lib/netscape${version}/$localized
	ln -fs /usr/lib/netscape${version}/$localized/Netscape-ja.ad_DeskTop /usr/lib/netscape${version}/$localized/Netscape
	touch /tmp/nc${version}
    fi
    export LD_PRELOAD=${MOZILLA_HOME}/libnsfix-ja.so
    if [ -f /usr/X11R6/lib/X11/ja_JP.eucJP/app-defaults/netscape.cfg ]; then
	#
	# Checking to see if script has been run as root
	#
	touch /tmp/foo.$$
	OWNER="`ls -l /tmp/foo.$$ | awk '{print $3}'`"
	rm -f /tmp/foo.$$
	NOSU=1
	if test ! "${OWNER}" = "root"
	then
	    if test ! "`who am i|awk '{print $1}'`" = "root" 
	    then
		if test ! "`whoami`" = "root" 
		then
		    if test ! ${USER} = "root" 
		    then 
			if test ! ${LOGNAME} = "root" 
			then
	echo '\\a##### WARNING.  Please Remove This File. #####'
        echo ' root (super user) ǤʤʲΥե뤳ȤǤޤ'
	echo ' /usr/X11R6/lib/X11/ja_JP.eucJP/app-defaults/netscape.cfg'
        echo ' root (super user) netscape.cfgեƤ'
	echo '##### WARNING.  Please Remove This File. #####\\a'
			    NOSU=1
			fi
		    fi
		fi
	    fi
	fi
	if test ${NOSU} = 0; then
	    rm /usr/X11R6/lib/X11/ja_JP.eucJP/app-defaults/netscape.cfg
	    echo '\\aŤ줿(netscape.cfg)ޤ\\a'
	fi
    fi
# Turbo Linux User setting.
elif [ -d /usr/src/turbo ]; then
    if [ ! -f /tmp/nc${version} ]; then
	cp /usr/lib/netscape${version}/$localized/TL/bookmark.htm /usr/lib/netscape${version}/$localized
	ln -fs /usr/lib/netscape${version}/$localized/Netscape-ja.ad_DeskTop /usr/lib/netscape${version}/$localized/Netscape
	touch /tmp/nc${version}
    fi
    export LD_PRELOAD=${MOZILLA_HOME}/libnsfix-ja.so
    if [ -f /usr/X11R6/lib/X11/ja_JP.eucJP/app-defaults/netscape.cfg ]; then
	#
	# Checking to see if script has been run as root
	#
	touch /tmp/foo.$$
	OWNER="`ls -l /tmp/foo.$$ | awk '{print $3}'`"
	rm -f /tmp/foo.$$
	NOSU=1
	if test ! "${OWNER}" = "root"
	then
	    if test ! "`who am i|awk '{print $1}'`" = "root" 
	    then
		if test ! "`whoami`" = "root" 
		then
		    if test ! ${USER} = "root" 
		    then 
			if test ! ${LOGNAME} = "root" 
			then
	echo  '##### WARNING.  Please Remove This File. #####'
        echo  'ƥroot(super user) ǤʤʲΥե뤳ȤǤޤ'
	echo  '/usr/X11R6/lib/X11/ja_JP.eucJP/app-defaults/netscape.cfg'
        echo  'ƥroot(super user) netscape.cfgեƤ'
	echo  '##### WARNING.  Please Remove This File. #####'
			    NOSU=1
			fi
		    fi
		fi
	    fi
	fi
	if test ${NOSU} = 0; then
	    rm /usr/X11R6/lib/X11/ja_JP.eucJP/app-defaults/netscape.cfg
	    echo  'Ť줿(netscape.cfg)ޤ'
	fi
    fi
# redhat Linux User setting.
elif [ -d /usr/src/redhat ]; then
    if [ ! -f /tmp/nc${version} ]; then
	cp /usr/lib/netscape${version}/$localized/redhat/bookmark.htm /usr/lib/netscape${version}/$localized
	ln -fs /usr/lib/netscape${version}/$localized/Netscape-ja.ad_SubNote /usr/lib/netscape${version}/$localized/Netscape
	touch /tmp/nc${version}
    fi
fi

# Mini (or Sub) NotePC User setting.
if test -d /proc
    then
    case "`/bin/cat /proc/devices`" in
	*127*)
	    ln -fs /usr/lib/netscape${version}/$localized/Netscape-ja.ad_MiniNote /usr/lib/netscape${version}/$localized/Netscape;;
	*254*)
	    ln -fs /usr/lib/netscape${version}/$localized/Netscape-ja.ad_MiniNote /usr/lib/netscape${version}/$localized/Netscape;;
	*pcmcia*)
	    ln -fs /usr/lib/netscape${version}/$localized/Netscape-ja.ad_MiniNote /usr/lib/netscape${version}/$localized/Netscape;;
	*);;
    esac
fi

exec ${MOZILLA_HOME}/netscape $@
