hwclock-set 776 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. # Reset the System Clock to UTC if the hardware clock from which it
  3. # was copied by the kernel was in localtime.
  4. dev=$1
  5. if [ -e /run/systemd/system ] ; then
  6. exit 0
  7. fi
  8. if [ -e /run/udev/hwclock-set ]; then
  9. exit 0
  10. fi
  11. if [ -f /etc/default/rcS ] ; then
  12. . /etc/default/rcS
  13. fi
  14. # These defaults are user-overridable in /etc/default/hwclock
  15. BADYEAR=no
  16. HWCLOCKACCESS=yes
  17. HWCLOCKPARS=
  18. HCTOSYS_DEVICE=rtc0
  19. if [ -f /etc/default/hwclock ] ; then
  20. . /etc/default/hwclock
  21. fi
  22. if [ yes = "$BADYEAR" ] ; then
  23. /sbin/hwclock --rtc=$dev --systz --badyear
  24. /sbin/hwclock --rtc=$dev --hctosys --badyear
  25. else
  26. /sbin/hwclock --rtc=$dev --systz
  27. /sbin/hwclock --rtc=$dev --hctosys
  28. fi
  29. # Note 'touch' may not be available in initramfs
  30. > /run/udev/hwclock-set