#!/bin/sh
#
# Copyright (c) 1993, by Sun Microsystems, Inc.
#
#ident	"$Header: /net/projects/S2.6/cvs/os_net/src_ws/usr/src/tadcmd/locations/init.d/tzone,v 1.2 1997/12/05 13:46:44 ang Exp $"
#
#LocINFO Portable Timezone Control
#

killproc() {		# kill the named process(es)
	pid=`/usr/bin/ps -e |
	     /usr/bin/grep " ${1}$" |
	     /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
	[ "$pid" != "" ] && kill $pid
}

procexist() {
    pid=`/usr/bin/ps -e | /usr/bin/grep " ${1}$" |
	     /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
    if [ -z "$pid" ]
    then
	return 1
    fi
    return 0
}

#
# Modify the portable timezone. This just changes the portable timezone
# on startup it does not convert from normal TZ to portable.
#
# To use portable timezone either set the TZ environment variable to
# PORTABLE_TZ in .profile, .cshrc... or change the assignation in
# /etc/default/init.
#

case "$1" in

'start')
    if [ -f $LOCDB/usr/share/lib/zoneinfo/portabletime ]
    then
	cp -p $LOCDB/usr/share/lib/zoneinfo/portabletime  /usr/share/lib/zoneinfo
    fi
    ;;

'stop')
    # It's possible you may want to do this?
#    echo "GMT" >/usr/share/lib/zoneinfo/portabletime
    ;;

'create')
    if [ -f /usr/share/lib/zoneinfo/portabletime ]
    then
	if [ ! -d $LOCDB/usr/share/lib/zoneinfo ]
	then
	    mkdir -p $LOCDB/usr/share/lib/zoneinfo
	fi
	cp -p /usr/share/lib/zoneinfo/portabletime $LOCDB/usr/share/lib/zoneinfo
    else
	exit 1
    fi
    ;;

*)
    echo "Usage: $0 { start | stop }"
    ;;
esac

exit 0
