mirror of
git://projects.qi-hardware.com/nanobits.git
synced 2024-11-23 17:55:18 +02:00
See ben-time-set changelog
This commit is contained in:
parent
ac84168269
commit
5d894ae6d7
@ -1,5 +1,22 @@
|
|||||||
ChangeLog for ben-time-set
|
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
|
17/09/11 Re-formatted the timezones file for easier pasring
|
||||||
Sused put how to generate dialog menus on the fly
|
Sused put how to generate dialog menus on the fly
|
||||||
Broke the menu down by Region so the list isn't too long
|
Broke the menu down by Region so the list isn't too long
|
||||||
|
@ -19,9 +19,11 @@
|
|||||||
|
|
||||||
# First we set up a few things
|
# First we set up a few things
|
||||||
|
|
||||||
VERSION="0.0.5"
|
VERSION="0.1.2"
|
||||||
BACKTITLE="Ben NanoNote Time/Date Utility"
|
BACKTITLE="Ben NanoNote Time/Date Utility"
|
||||||
TIMEZONE=""
|
TIMEZONE=""
|
||||||
|
TZFILE="/usr/share/ben-time-set/timezones"
|
||||||
|
NOTZ=0
|
||||||
#DATEFORMAT="%Y%m%d"
|
#DATEFORMAT="%Y%m%d"
|
||||||
#TIMEFORMAT="%H%M"
|
#TIMEFORMAT="%H%M"
|
||||||
setfont /usr/share/kbd/consolefonts/kernel-6x11-font # size down the font so the Calendar widget fits.
|
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
|
exit 1
|
||||||
fi
|
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
|
# Intro and Instructions
|
||||||
|
|
||||||
dialog --backtitle "$BACKTITLE" --cr-wrap --trim --msgbox "Use this utility to set the time, date\n\
|
dialog --backtitle "$BACKTITLE" --cr-wrap --trim --msgbox "Use this utility to set the time, date\n\
|
||||||
@ -46,34 +69,47 @@ use the directional pad to set the value.\n" 0 0
|
|||||||
|
|
||||||
# Set Timezone first as that requires a reboot
|
# Set Timezone first as that requires a reboot
|
||||||
|
|
||||||
TZ=`cat /etc/TZ`
|
if [ $NOTZ == 0 ]; then
|
||||||
|
|
||||||
# Is timezone right?
|
TZ=`cat /etc/TZ`
|
||||||
|
|
||||||
dialog --backtitle "$BACKTITLE" --yesno "Timezone is: "$TZ" \nIs this correct?" 0 0
|
# Is timezone right?
|
||||||
|
|
||||||
if [ "$?" != "0" ]; then
|
dialog --backtitle "$BACKTITLE" --yesno "Timezone is: "$TZ" \nIs this correct?" 0 0
|
||||||
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
|
||||||
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
|
dialog --backtitle "$BACKTITLE" --menu "Select your Region:" 0 0 8 Africa "" America "" Antarctica "" Arctic "" Asia "" Atlantic "" Australia "" Europe "" Indian "" Pacific "" 2>/tmp/result
|
||||||
TIMEZONE=$(</tmp/result)
|
if [ "$?" != "0" ]; then
|
||||||
#echo $TIMEZONE
|
exit 1
|
||||||
#exit 1
|
fi
|
||||||
#Commit Timezone string to firmware
|
ZONES=( $(grep -i $(</tmp/result) "$TZFILE" | cut -f2- -d/) )
|
||||||
uci set system.@system[0].timezone="$TIMEZONE"
|
|
||||||
uci commit system
|
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
|
||||||
#Clean-up
|
if [ "$?" != "0" ]; then
|
||||||
rm /tmp/result
|
exit 1
|
||||||
#ASK to reboot... (Pet peeve.. never reboot by default)
|
fi
|
||||||
dialog --backtitle "$BACKTITLE" --yesno "Timezone has been set\nSystem will now restart so Linux can adjust.\n\n Reboot?" 0 0
|
TIMEZONE=$(</tmp/result)
|
||||||
if [ "$?" == 0 ]; then
|
|
||||||
reboot
|
#Commit Timezone string to firmware
|
||||||
exit 0
|
uci set system.@system[0].timezone="$TIMEZONE"
|
||||||
else
|
uci commit system
|
||||||
exit 0
|
|
||||||
|
#Clean-up
|
||||||
|
rm /tmp/result
|
||||||
|
|
||||||
|
#ASK to reboot... (Pet peeve.. never reboot by default)
|
||||||
|
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
|
||||||
fi
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
# Get the Date
|
# Get the Date
|
||||||
|
|
Loading…
Reference in New Issue
Block a user