kk_milislinux-saat 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/sh
  2. # Milislinux uyarlı zaman ayarlama betiği
  3. if [ ! -d "/var/lib/pkg/DB/xdialog" ];then
  4. echo "xdialog paketini kurunuz-> mps kur xdialog"
  5. exit 1
  6. fi
  7. HWCLOCK=/sbin/hwclock
  8. if [ -f "/usr/sbin/hwclock" ];then
  9. HWCLOCK=/usr/sbin/hwclock
  10. fi
  11. # Title to be used for all Xdialog boxes.
  12. TITLE="Saat Ayarlama Aracı"
  13. # Now check for hwclock existence...
  14. if ! [ -f $HWCLOCK ] ; then
  15. Xdialog --title "$TITLE" --msgbox "$HWCLOCK bulunamadı..." 0 0
  16. exit 0
  17. fi
  18. # Get the date (returned in DD/MM/YYYY format by Xdialog.
  19. ENTEREDDATE=`Xdialog --stdout --title "$TITLE" --calendar "Tarihi ayarlayın..." 0 0 0 0 0`
  20. #xmessage $?
  21. if [ "$?" != "0" ] ; then
  22. Xdialog --title "$TITLE" --msgbox "İptal edildi." 0 0
  23. exit 0
  24. fi
  25. # Convert the date to the MM/DD/YYYY format needed by hwclock.
  26. NEWDATE=`echo "$ENTEREDDATE" | awk --source 'BEGIN { FS="/" }' --source '{ print $2 "/" $1 "/" $3 }'`
  27. # Get the time in HH:MM:SS format.
  28. NEWTIME=`Xdialog --stdout --title "$TITLE" --timebox "Zamanı ayarlayın..." 0 0`
  29. if [ "$?" != "0" ] ; then
  30. Xdialog --title "$TITLE" --msgbox "Aborted." 0 0
  31. exit 0
  32. fi
  33. # Set the hardware clock (RTC) and then the system clock
  34. Xdialog --title "bilgi" --msgbox "Gerekli ayarlamalar yapılıyor..." 0 0
  35. $HWCLOCK --set --date="$NEWDATE $NEWTIME"&&$HWCLOCK --hctosys
  36. THEDATE=`date`
  37. Xdialog --title "bilgi" --msgbox "Zaman ayarlama yapıldı. $THEDATE" 0 0