diff options
author | Bill Nottingham <notting@redhat.com> | 1999-06-17 04:17:45 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 1999-06-17 04:17:45 +0000 |
commit | 2b7bb223b166e97f6a96b62204e9447ff82f924a (patch) | |
tree | 6f85c6dd1744245cb3c72f3f8b29afb8b03372f8 | |
parent | 05e38c0c8ac239696bbc4f0dda1b12ecf29f4e85 (diff) | |
download | initscripts-2b7bb223b166e97f6a96b62204e9447ff82f924a.tar initscripts-2b7bb223b166e97f6a96b62204e9447ff82f924a.tar.gz initscripts-2b7bb223b166e97f6a96b62204e9447ff82f924a.tar.bz2 initscripts-2b7bb223b166e97f6a96b62204e9447ff82f924a.tar.xz initscripts-2b7bb223b166e97f6a96b62204e9447ff82f924a.zip |
set clock as soon as possible...
-rwxr-xr-x | rc.d/rc.sysinit | 95 |
1 files changed, 54 insertions, 41 deletions
diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index 419e76dc..0ddb45ed 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -25,9 +25,60 @@ fi # Source functions . /etc/rc.d/init.d/functions +set_the_clock() { + # Set the system clock. + ARC=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 + + CLOCKDEF="" + if [ -x /sbin/hwclock ]; then + CLOCKFLAGS="--hctosys" + CLOCK=/sbin/hwclock + $CLOCK --adjust + else + CLOCKFLAGS="-a" + CLOCK=/sbin/clock + fi + + case "$UTC" in + yes|true) + CLOCKFLAGS="$CLOCKFLAGS -u"; + CLOCKDEF="$CLOCKDEF (utc)"; + ;; + esac + + if [ "$CLOCK" = "/sbin/clock" ]; then + case "$ARC" in + yes|true) + CLOCKFLAGS="$CLOCKFLAGS -A"; + CLOCKDEF="$CLOCKDEF (arc)"; + ;; + esac + fi + + $CLOCK $CLOCKFLAGS + + action "Setting clock $CLOCKDEF: `date`" date +} + # Fix console loglevel /sbin/loglevel $LOGLEVEL +# Set clock, if we can... +if [ -f /etc/localtime ]; then + set_the_clock +fi + # Load keymap KEYMAP= if [ -f /etc/sysconfig/console/default.kmap ]; then @@ -317,49 +368,11 @@ rm -f /tmp/.X*-lock # Delete Postgres sockets rm -f /tmp/.s.PGSQL.* -# Set the system clock. -ARC=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 +# If we didn't set the clock before, set it now... +if [ ! -f /etc/localtime ]; then + set_the_clock fi -CLOCKDEF="" -if [ -x /sbin/hwclock ]; then - CLOCKFLAGS="--hctosys" - CLOCK=/sbin/hwclock - $CLOCK --adjust -else - CLOCKFLAGS="-a" - CLOCK=/sbin/clock -fi - -case "$UTC" in - yes|true) - CLOCKFLAGS="$CLOCKFLAGS -u"; - CLOCKDEF="$CLOCKDEF (utc)"; - ;; -esac - -if [ "$CLOCK" = "/sbin/clock" ]; then - case "$ARC" in - yes|true) - CLOCKFLAGS="$CLOCKFLAGS -A"; - CLOCKDEF="$CLOCKDEF (arc)"; - ;; - esac -fi - -$CLOCK $CLOCKFLAGS -action "Setting clock $CLOCKDEF: `date`" date - # Right, now turn on swap in case we swap to files. swapon -a >/dev/null 2>&1 action "Enabling swap space" /bin/true |