X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=recipes%2Fpandora-system%2Fpandora-scripts%2Fop_datetime.sh;h=3debe6968bcbe8dc0d977dea3bf1ed187f84466f;hb=62230ce21a3aa61e2744fd6a8ed38257da4d2fe2;hp=04aa5ed7b9a55fe332560b236d2471e08bd8a57b;hpb=c0813df0c77aa3aa3db04c6bebbfbd013041fa82;p=openpandora.oe.git diff --git a/recipes/pandora-system/pandora-scripts/op_datetime.sh b/recipes/pandora-system/pandora-scripts/op_datetime.sh old mode 100755 new mode 100644 index 04aa5ed..3debe69 --- a/recipes/pandora-system/pandora-scripts/op_datetime.sh +++ b/recipes/pandora-system/pandora-scripts/op_datetime.sh @@ -2,7 +2,7 @@ # Set the timezone and date/time -while mainsel=$(zenity --title="Date / Time / Timezone" --width="400" --height="250" --list --column "id" --column "Please select" --hide-column=1 --text="You can set the time and date or select a different timezone.\n" "td" "Change Time and Date" "tz" "Select Timezone" --ok-label="Change Setting" --cancel-label="Exit"); do +while mainsel=$(zenity --title="Date / Time / Timezone" --width="400" --height="250" --list --column "id" --column "Please select" --hide-column=1 --text="You can set the time and date or select a different timezone.\n" "td" "Change Time and Date" "tz" "Select Timezone" "sync" "Sync time over Internet" --ok-label="Change Setting" --cancel-label="Exit"); do case $mainsel in @@ -39,7 +39,7 @@ case $mainsel in time_m=`date +%M` while true; do - time=$(zenity --title="Enter actual time" --entry --text "Please enter the time in 24hour format (HH:MM).\n\nThe screen might blank out after you changed the time.\nDon't panic. Simply press a button on the keyboard.\n" --entry-text "$time_h:$time_m") || exit 1 + time=$(zenity --title="Enter actual time" --entry --text "Please enter the time in 24hour format (HH:MM).\n" --entry-text "$time_h:$time_m") || exit 1 if test -n "$time" && date -d "$time"; then break; fi @@ -61,6 +61,24 @@ case $mainsel in xset s on fi ;; - + "sync") + screensaver_enabled=true + if xset q | grep -A2 'Screen Saver' | grep -q 'timeout:.*\<0\>.*cycle'; then + screensaver_enabled=false + fi + xset s off + ( + test -e /etc/init.d/ntpd && sudo /etc/init.d/ntpd stop + sudo ntpdate pool.ntp.org + ) | + zenity --progress \ + --title="Syncing..." \ + --text="Syncing with time server...\nPlease wait a while..." \ + --pulsate + test -e /etc/init.d/ntpd && sudo /etc/init.d/ntpd start + if $screensaver_enabled; then + xset s on + fi + ;; esac done