diff --git a/ben-time-set/Change-Log.txt b/ben-time-set/Change-Log.txt index b799eb8..76fbb05 100644 --- a/ben-time-set/Change-Log.txt +++ b/ben-time-set/Change-Log.txt @@ -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 diff --git a/ben-time-set/ben-time-set.sh b/ben-time-set/usr/bin/ben-time-set.sh similarity index 56% rename from ben-time-set/ben-time-set.sh rename to ben-time-set/usr/bin/ben-time-set.sh index ebe4c33..1c83ed0 100755 --- a/ben-time-set/ben-time-set.sh +++ b/ben-time-set/usr/bin/ben-time-set.sh @@ -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,34 +69,47 @@ use the directional pad to set the value.\n" 0 0 # 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" --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 - TIMEZONE=$(/tmp/result + if [ "$?" != "0" ]; then + exit 1 + fi + ZONES=( $(grep -i $(/tmp/result + if [ "$?" != "0" ]; then + exit 1 + fi + TIMEZONE=$(