1
0
mirror of git://projects.qi-hardware.com/nanobits.git synced 2024-11-23 17:43:09 +02:00

See ben-time-set changelog

This commit is contained in:
Freemor 2011-11-16 12:03:31 -04:00
parent ac84168269
commit 5d894ae6d7
3 changed files with 77 additions and 24 deletions

View File

@ -1,5 +1,22 @@
ChangeLog for ben-time-set
16/11/11 Added checks for Cancel on Timezone Dialogues
Tested timezone file checks
Moved Files to /usr/bin and /usr/share
Cleaned up some Typos
Bumped version to 0.1.2
Tried to set sensible permissions on files
Tried to set right user (root? 1001?)
Fixed lack of pause after no timezones warning
15/11/11 Start adding if to check for timezones file
bump version to 0.1.0 to reflect all the earlier work
not mentioned here
Minor clean-ups on some of the wording
Change the changelog.. duh
17/09/11 Re-formatted the timezones file for easier pasring
Sused put how to generate dialog menus on the fly
Broke the menu down by Region so the list isn't too long

View File

@ -19,9 +19,11 @@
# First we set up a few things
VERSION="0.0.5"
VERSION="0.1.2"
BACKTITLE="Ben NanoNote Time/Date Utility"
TIMEZONE=""
TZFILE="/usr/share/ben-time-set/timezones"
NOTZ=0
#DATEFORMAT="%Y%m%d"
#TIMEFORMAT="%H%M"
setfont /usr/share/kbd/consolefonts/kernel-6x11-font # size down the font so the Calendar widget fits.
@ -37,6 +39,27 @@ if [ ! -e /usr/bin/dialog ]; then
exit 1
fi
# Check that we have a timezones file
if [ ! -e /usr/share/ben-time-set/timezones ]; then
if [ -e ./timezones ]; then
TZFILE="./timezones"
else
echo "oops.. no timezones file"
echo "We will be unable to set the Timezone."
echo "If you want to be able to set the timezone"
echo "Please download the timezones file and save"
echo "it to the same folder as the script or"
echo "/usr/share/ben-time-set/"
echo "--"
read -p "Press a key to continue" -n1 -s
NOTZ=1
fi
fi
echo $TZFILE, $NOTZ
#exit 0
# Intro and Instructions
dialog --backtitle "$BACKTITLE" --cr-wrap --trim --msgbox "Use this utility to set the time, date\n\
@ -46,6 +69,8 @@ use the directional pad to set the value.\n" 0 0
# Set Timezone first as that requires a reboot
if [ $NOTZ == 0 ]; then
TZ=`cat /etc/TZ`
# Is timezone right?
@ -54,26 +79,37 @@ dialog --backtitle "$BACKTITLE" --yesno "Timezone is: "$TZ" \nIs this correct?"
if [ "$?" != "0" ]; then
dialog --backtitle "$BACKTITLE" --menu "Select your Region:" 0 0 8 Africa "" America "" Antarctica "" Arctic "" Asia "" Atlantic "" Australia "" Europe "" Indian "" Pacific "" 2>/tmp/result
ZONES=( $(grep -i $(</tmp/result) timezones | cut -f2- -d/) )
if [ "$?" != "0" ]; then
exit 1
fi
ZONES=( $(grep -i $(</tmp/result) "$TZFILE" | cut -f2- -d/) )
dialog --backtitle "$BACKTITLE" --menu "Select the nearest City:" 0 0 8 `for ITEM in $(seq 0 $((${#ZONES[@]} - 1))); do echo ${ZONES[$ITEM]#*|} ${ZONES[$ITEM]%|*}; done` 2>/tmp/result
if [ "$?" != "0" ]; then
exit 1
fi
TIMEZONE=$(</tmp/result)
#echo $TIMEZONE
#exit 1
#Commit Timezone string to firmware
uci set system.@system[0].timezone="$TIMEZONE"
uci commit system
#Clean-up
rm /tmp/result
#ASK to reboot... (Pet peeve.. never reboot by default)
dialog --backtitle "$BACKTITLE" --yesno "Timezone has been set\nSystem will now restart so Linux can adjust.\n\n Reboot?" 0 0
dialog --backtitle "$BACKTITLE" --yesno "Timezone has been set\nSystem now needs to restart so Linux can adjust.\n\n Reboot?" 0 0
if [ "$?" == 0 ]; then
reboot
exit 0
else
clear
echo -e "Remember to reboot so new Timezone can take effect.\n\n"
exit 0
fi
fi
fi
# Get the Date