#!/bin/sh

# @(#) PatchTimeZone - patch Preferences.app for timezone - 1.0 12/sep/93
#
# Bjorn Asle Valde (valde@uib.no)
# Patch by Klaus Bscheid (klaus@ideal.muc.de)
#
# USE AT YOUR OWN RISK
 
labelfile=__INFO.labels
apptopatch=/NextApps/Preferences.app
progtopatch=Preferences
backupfile=Preferences.orig
mywd=`pwd`

check_for_root()
{
user=`whoami`

if [ "$user" != "root" ]; then
	cat <<- EOF 

	You must be root to patch preferences.

	Please login as user "root" and run
	this program, or authenticate yourself
	as superuser by keying in "su" in a terminal
	window, supply the root password, and run
	this program by typing:

	sh PatchTimeZone

EOF
exit 1
fi
}

check_is_patched()
{
cd $apptopatch
if [ -f $backupfile ]; then
   echo 'Prefences seems to be patched, no point in doing it a second time'
   exit 1
fi
}

patch_Preferences()
{
echo -n Patching Preferences... 
patchfile=$mywd/$labelfile
cd $apptopatch
cp -p Preferences Preferences.orig
segedit Preferences.orig -replace __INFO labels $patchfile -o Preferences
echo done.
}

#                              ***** MAIN *****

check_for_root
check_is_patched
patch_Preferences
cat <<- EOF

Succesfully patched Preferences.app

Now start Preferences.app and select MET
or CET as your time zone for Europe. If 
you run the command "date" in a terminal
window after having set the timezone
you should get an answer looking
something like this:

Sun Sep 12 15:49:44 MET DST 1993

You local date/time and timezone is now:

EOF
echo `date`
cd $mywd
exit 0