From: Tomek Orzechowski Date: Mon, 31 Mar 2003 20:43:40 +0000 (+0000) Subject: - experimental SYNC_HWCLOCK support X-Git-Tag: deadbranch-1.4.2~2 X-Git-Url: https://git.pld-linux.org/?a=commitdiff_plain;h=83c84c8022b7e8edf3da495468137002bda6dc6a;p=packages%2Frdate.git - experimental SYNC_HWCLOCK support Changed files: rdate.cron -> 1.4 rdate.sysconfig -> 1.2 --- diff --git a/rdate.cron b/rdate.cron index fca69ae..1f47e06 100644 --- a/rdate.cron +++ b/rdate.cron @@ -12,6 +12,45 @@ if [ -f /etc/sysconfig/rdate ]; then fi # Check that networking is up. -if [ "is_yes ${NETWORKING}" -a "is_yes ${SET_TIME}" -a -n "${RDATE_SERVER}" ]; then - /usr/bin/rdate -s -l $RDATE_SERVER +if [ is_yes "${NETWORKING}" -a is_yes "${SET_TIME}" -a -n "${RDATE_SERVERS}" ]; then + /usr/bin/rdate -s "${RDATE_SERVERS}" + if [ $? -eq 0 -a is_yes "${SYNC_HWCLOCK}" -a -x /sbin/hwclock ]; then + # Set the system clock. + ARC=0 + SRM=0 + UTC=0 + + if [ -f /etc/sysconfig/clock ]; then + . /etc/sysconfig/clock + + # convert old style clock config to new values + if [ "${CLOCKMODE}" = "GMT" ]; then + UTC=true + elif [ "${CLOCKMODE}" = "ARC" ]; then + ARC=true + fi + fi + + if grep "system serial" /proc/cpuinfo | grep -q MILO ; then + ARC=true + fi + + CLOCKFLAGS="--systohc" + + if is_yes "$UTC" ; then + CLOCKFLAGS="$CLOCKFLAGS --utc" + else + CLOCKFLAGS="$CLOCKFLAGS --localtime" + fi + + if is_yes "$ARC" ; then + CLOCKFLAGS="$CLOCKFLAGS -A" + fi + + if is_yes "$SRM" ; then + CLOCKFLAGS="$CLOCKFLAGS -S" + fi + + /sbin/hwclock $CLOCKFLAGS + fi fi diff --git a/rdate.sysconfig b/rdate.sysconfig index e9a6fda..3b66ab0 100644 --- a/rdate.sysconfig +++ b/rdate.sysconfig @@ -1,5 +1,8 @@ # Do you want to set data from remote server at all? #SET_TIME="yes" +# Do you want to sync hardware clock with system time? +#SYNC_HWCLOCK="yes" + # From which server? -#RDATE_SERVER="" +#RDATE_SERVERS=""