#! /bin/sh # Copyright (C) 2001 Software in the Public Interest # # Licensed under the GPL v2 # show_continents() { cat < $TIMEZONES ) valid=no while [ $valid = no ]; do show_continents echo -n "Number: " ; read area case $area in 1) continent=Africa ; valid=yes ;; 2) continent=America ; valid=yes ;; 3) continent=US ; valid=yes ;; 4) continent=Canada ; valid=yes ;; 5) continent=Asia ; valid=yes ;; 6) continent=Atlantic ; valid=yes ;; 7) continent=Australia ; valid=yes ;; 8) continent=Europe ; valid=yes ;; 9) continent=Indian ; valid=yes ;; 10) continent=Pacific ; valid=yes ;; 11) continent=SystemV ; valid=yes ;; 12) continent=Etc ; valid=yes ;; esac done if [ -x /usr/bin/fmt ]; then fmt_bin=/usr/bin/fmt else fmt_bin=/bin/more ; fi valid=no zone="" while [ $valid = no ]; do if [ -n "$zone" ]; then # We accept the zone if either it is an unambiguous prefix, or # it is a complete zone name. number=`grep -i -c "^$continent/$zone" $TIMEZONES` if [ $number -eq 1 ]; then timezone=`grep -i "^$continent/$zone" $TIMEZONES` else timezone=`grep -i -s "^$continent/$zone"'$' $TIMEZONES` fi if [ -n "$timezone" ]; then zone_info echo "Your default time zone is set to '$timezone'.$extra_info" valid=yes break fi fi echo grep -i "^$continent/$zone" $TIMEZONES | cut -d/ -f2- | $fmt_bin echo echo "Please enter the name of one of these cities or zones" echo "You just need to type enough letters to resolve ambiguities" echo "Press Enter to view all of them again" echo -n "Name: [$zone] " ; read zone done echo $timezone > /etc/timezone #zic -l $timezone rm -f /etc/localtime && ln -sf /usr/share/zoneinfo/$timezone /etc/localtime trap 'rm -f $TIMEZONES' 0 1 2 3 13 15