#!/bin/shif [ "$(id -u)" -ne 0 ]; then [ -x "$(which su-to-root)" ] && exec su-to-root -X -c "$0" "$@" printf "ERROR: $0 needs root capabilities, please start it as root.\n\n" >&2 exit 1fi# get time servers from /etc/default/ntpdate. /etc/default/ntpdate[ -z "$NTPSERVER" ] && NTPSERVER="pool.ntp.org"# assume the hw clock being in local timehwclock --hctosys --localtime# let the user set their time zonedpkg-reconfigure tzdata# sync with time serversfor i in $NTPSERVER; do if ntpdate -u -b "$i"; then hwclock --systohc break fidone