#!/bin/sh # tzset by Linus Sphinx 4/10/2004 # Copyright (c) 2004 Linus Sphinx # Part of the gn*nix conspiracy http://gnnix.org # when consultants attack... # DIALOGRC=/etc/bw.rc zones() { let x=1 ls -1 | sort -r | while read i do s=`echo $i | sed s/[A-Z]//g` if [ "$s" != "$i" ]; then echo $i $x let x=$x+1 fi done } settimezone() { TZDIR=/usr/share/zoneinfo notset=1 cd $TZDIR while [ "$notset" = "1" ] do dialog --menu "Select Zone or Country" 0 0 0 `zones` 2> /tmp/tz TZ=`cat /tmp/tz` if [ -f $TZ ]; then TZPATH=$TZPATH/$TZ notset=0 else TZPATH=${TZPATH}/${TZ} cd $TZ fi done echo $TZPATH > /tmp/tz ln -sf ${TZDIR}${TZPATH} /etc/localtime if [ "$TZPATH" = "/UTC" ]; then echo UTC > /etc/hardwareclock else echo localtime > /etc/hardwareclock fi } settimezone if [ -s /tmp/tz ]; then hc=`cat /etc/hardwareclock` tm=`cat /tmp/tz` dialog --msgbox "hardware clock set to: $hc timezone set to: $tm" 0 0 fi clear