diff --git a/packages/sysutils/busybox/config/busybox.conf b/packages/sysutils/busybox/config/busybox.conf index f9cd8498b3..ff015bc0d0 100644 --- a/packages/sysutils/busybox/config/busybox.conf +++ b/packages/sysutils/busybox/config/busybox.conf @@ -557,7 +557,7 @@ CONFIG_FEATURE_USE_TERMIOS=y # CONFIG_FEATURE_MOUNT_FLAGS is not set # CONFIG_FEATURE_MOUNT_FSTAB is not set # CONFIG_PIVOT_ROOT is not set -# CONFIG_RDATE is not set +CONFIG_RDATE=y # CONFIG_RDEV is not set # CONFIG_READPROFILE is not set # CONFIG_RTCWAKE is not set diff --git a/packages/sysutils/busybox/config/time.conf b/packages/sysutils/busybox/config/time.conf new file mode 100644 index 0000000000..eeffe017b3 --- /dev/null +++ b/packages/sysutils/busybox/config/time.conf @@ -0,0 +1,2 @@ +# Timeserver + TIMEHOST="pool.net.org" diff --git a/packages/sysutils/busybox/init.d/44_rdate b/packages/sysutils/busybox/init.d/44_rdate new file mode 100755 index 0000000000..b94557f313 --- /dev/null +++ b/packages/sysutils/busybox/init.d/44_rdate @@ -0,0 +1,31 @@ +#!/bin/sh + +################################################################################ +# Copyright (C) 2009-2010 OpenELEC.tv +# http://www.openelec.tv +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +# +# run rdate update system time +# +# runlevels: openelec, textmode + +. /etc/profile + + progress "Syncronizing time" + timesync & diff --git a/packages/sysutils/busybox/install b/packages/sysutils/busybox/install index d3de6eb063..2234042664 100755 --- a/packages/sysutils/busybox/install +++ b/packages/sysutils/busybox/install @@ -18,6 +18,9 @@ USER_PWD="`$ROOT/$TOOLCHAIN/bin/cryptpw $USER_PASSWORD`" mkdir -p $INSTALL/bin cp $PKG_DIR/scripts/lsb-release $INSTALL/bin/ + mkdir -p $INSTALL/usr/bin + cp $PKG_DIR/scripts/timesync $INSTALL/usr/bin/ + mkdir -p $INSTALL/sbin cp $PKG_DIR/scripts/init $INSTALL/sbin/ @@ -50,3 +53,11 @@ USER_PWD="`$ROOT/$TOOLCHAIN/bin/cryptpw $USER_PASSWORD`" mkdir -p $INSTALL/etc/modprobe.d cp $PKG_DIR/modprobe.d/* $INSTALL/etc/modprobe.d + + mkdir -p $INSTALL/etc/crontabs + echo -e "* 21 * * *\t/usr/bin/timesync" >> $INSTALL/etc/crontabs/root + + mkdir -p $INSTALL/usr/config + cp $PKG_DIR/config/time.conf $INSTALL/usr/config + + diff --git a/packages/sysutils/busybox/scripts/timesync b/packages/sysutils/busybox/scripts/timesync new file mode 100755 index 0000000000..3fde9d0508 --- /dev/null +++ b/packages/sysutils/busybox/scripts/timesync @@ -0,0 +1,31 @@ +#!/bin/sh + +################################################################################ +# Copyright (C) 2009-2010 OpenELEC.tv +# http://www.openelec.tv +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +. /etc/profile + +[ -f $HOME/.config/time.conf ] && . $HOME/.config/time.conf + +if [ -n "$TIMEHOST" ]; then + wait_for_network # wait for networking + usleep 500000 + rdate "$TIMEHOST" & +fi