clock init script now handles /etc/adjtime correctly. CLOCK_ADJTIME hinted that it could change the location of /etc/adjtime. This is not the case.
This commit is contained in:
parent
dc3bce5dae
commit
bf0cc2dac4
@ -1,6 +1,12 @@
|
|||||||
# ChangeLog for Gentoo System Intialization ("rc") scripts
|
# ChangeLog for Gentoo System Intialization ("rc") scripts
|
||||||
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
|
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
|
||||||
|
|
||||||
|
23 Oct 2007; Roy Marples <uberlord@gentoo.org>:
|
||||||
|
|
||||||
|
clock init script now handles /etc/adjtime correctly.
|
||||||
|
CLOCK_ADJTIME hinted that it could change the location of /etc/adjtime.
|
||||||
|
This is not the case.
|
||||||
|
|
||||||
19 Oct 2007; Roy Marples <uberlord@gentoo.org>:
|
19 Oct 2007; Roy Marples <uberlord@gentoo.org>:
|
||||||
|
|
||||||
Mount /dev/shm for Linux systems, even not when in /etc/fstab, #196345.
|
Mount /dev/shm for Linux systems, even not when in /etc/fstab, #196345.
|
||||||
|
@ -3,17 +3,10 @@
|
|||||||
|
|
||||||
CLOCK_OPTS=""
|
CLOCK_OPTS=""
|
||||||
|
|
||||||
# Newer FHS specs say this file should live in /var/lib rather than
|
# Set CLOCK_ADJTIME if you wish hwclock to try and handle clock drift.
|
||||||
# /etc. If you care about such things, feel free to change this value.
|
# Don't set this if you run a ntp service or anything else that handles
|
||||||
# Note that a blank value means that you do not wish to even use the
|
# clock drift.
|
||||||
# adjtime facility. This is the default behavior as adjtime can be
|
CLOCK_ADJTIME="no"
|
||||||
# very fragile. If the clock is updated without updating the adjtime
|
|
||||||
# file (which is common when using services such as ntp), then the
|
|
||||||
# clock can be screwed up when it gets updated at next boot.
|
|
||||||
|
|
||||||
#CLOCK_ADJTIME="/var/lib/adjtime"
|
|
||||||
#CLOCK_ADJTIME="/etc/adjtime"
|
|
||||||
CLOCK_ADJTIME=""
|
|
||||||
|
|
||||||
|
|
||||||
### ALPHA SPECIFIC OPTIONS ###
|
### ALPHA SPECIFIC OPTIONS ###
|
||||||
|
@ -9,13 +9,20 @@ description_save="Saves the current time in the BIOS."
|
|||||||
|
|
||||||
depend() {
|
depend() {
|
||||||
case "${CLOCK_ADJTIME}" in
|
case "${CLOCK_ADJTIME}" in
|
||||||
"") before *;;
|
""|no) before *;;
|
||||||
/etc/*) need checkroot;;
|
/etc/*|yes) need checkroot;;
|
||||||
*) need localmount;;
|
*) need localmount;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
setupopts() {
|
setupopts() {
|
||||||
|
myopts=
|
||||||
|
|
||||||
|
case "${CLOCK_ADJTIME}" in
|
||||||
|
no) CLOCK_ADJTIME=;;
|
||||||
|
yes) CLOCK_ADJTIME="/etc/adjtime";;
|
||||||
|
esac
|
||||||
|
|
||||||
case "${RC_SYS}" in
|
case "${RC_SYS}" in
|
||||||
UML|VPS|XEN)
|
UML|VPS|XEN)
|
||||||
TBLURB="${RC_SYS}"
|
TBLURB="${RC_SYS}"
|
||||||
@ -44,19 +51,16 @@ setupopts() {
|
|||||||
esac
|
esac
|
||||||
[ ${fakeit} -eq 1 ] && return 0
|
[ ${fakeit} -eq 1 ] && return 0
|
||||||
|
|
||||||
if [ -z "${CLOCK_ADJTIME}" -o ! -w /etc ] ; then
|
[ -w /etc -a -n "${CLOCK_ADJTIME}" ] || myopts="${myopts} --noadjfile"
|
||||||
myadj="--noadjfile"
|
|
||||||
else
|
|
||||||
myadj="--adjust"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ "${SRM}" = "yes" ] && myopts="${myopts} --srm"
|
[ "${SRM}" = "yes" ] && myopts="${myopts} --srm"
|
||||||
[ "${ARC}" = "arc" ] && myopts="${myopts} --arc"
|
[ "${ARC}" = "arc" ] && myopts="${myopts} --arc"
|
||||||
myopts="${myopts} ${CLOCK_OPTS}"
|
myopts="${myopts} ${CLOCK_OPTS}"
|
||||||
|
|
||||||
# Make sure user isn't using rc.conf anymore.
|
# Make sure user isn't using rc.conf anymore.
|
||||||
if grep -q "^CLOCK=" /etc/rc.conf ; then
|
if [ -e /etc/rc.conf ] && \
|
||||||
ewarn $"CLOCK should not be set in /etc/rc.conf but in /etc/conf.d/clock"
|
[ -n "$(unset CLOCK; . /etc/rc.conf; echo "${CLOCK}")" ] ; then
|
||||||
|
ewarn "CLOCK should not be set in /etc/rc.conf but in /etc/conf.d/clock"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure people set their timezone ... we do it here
|
# Make sure people set their timezone ... we do it here
|
||||||
@ -70,26 +74,21 @@ setupopts() {
|
|||||||
start() {
|
start() {
|
||||||
local myopts= myadj= TBLURB= fakeit=0 errstr="" retval=0
|
local myopts= myadj= TBLURB= fakeit=0 errstr="" retval=0
|
||||||
|
|
||||||
if [ -x /sbin/hwclock ] ; then
|
|
||||||
[ -w "${CLOCK_ADJTIME}" ] && echo "0.0 0 0.0" > "${CLOCK_ADJTIME}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
setupopts
|
setupopts
|
||||||
|
|
||||||
if [ ${fakeit} -ne 1 -a -e /proc/modules -a ! -e /dev/rtc ] ; then
|
if [ ${fakeit} -ne 1 -a -e /proc/modules -a ! -e /dev/rtc ] ; then
|
||||||
modprobe -q rtc || modprobe -q genrtc
|
modprobe -q rtc || modprobe -q genrtc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ebegin "Setting system clock using the hardware clock" "[${TBLURB}]"
|
ebegin "Setting system clock using the hardware clock [${TBLURB}]"
|
||||||
if [ ${fakeit} -eq 1 ] ; then
|
if [ ${fakeit} -eq 1 ] ; then
|
||||||
retval=0
|
retval=0
|
||||||
elif [ -x /sbin/hwclock ] ; then
|
elif [ -x /sbin/hwclock ] ; then
|
||||||
# Don't call hwclock unless we need to
|
# Don't call hwclock unless we need to
|
||||||
if [ "${TBLURB}" != "UTC" -o "${myadj}" != "--noadjfile" ] ; then
|
if [ "${TBLURB}" != "UTC" -o "${myopts#*--noadjfile}" = "${myopts}" ] ; then
|
||||||
# Since hwclock always exit's with a 0, need to check its output.
|
# Since hwclock always exit's with a 0, need to check its output.
|
||||||
errstr="$(/sbin/hwclock ${myadj} ${myopts} 2>&1 >/dev/null)"
|
[ -n "${CLOCK_ADJTIME}" ] && errstr="$(/sbin/hwclock --adjust 2>&1 >/dev/null)"
|
||||||
errstr="${errstr}$(/sbin/hwclock --hctosys ${myopts} 2>&1 >/dev/null)"
|
errstr="${errstr}$(/sbin/hwclock --hctosys ${myopts} 2>&1 >/dev/null)"
|
||||||
|
|
||||||
if [ -n "${errstr}" ] ; then
|
if [ -n "${errstr}" ] ; then
|
||||||
ewarn "${errstr}"
|
ewarn "${errstr}"
|
||||||
retval=1
|
retval=1
|
||||||
@ -117,12 +116,15 @@ stop() {
|
|||||||
if [ ${fakeit} -eq 1 ] ; then
|
if [ ${fakeit} -eq 1 ] ; then
|
||||||
retval=0
|
retval=0
|
||||||
elif [ -x /sbin/hwclock ] ; then
|
elif [ -x /sbin/hwclock ] ; then
|
||||||
[ -z "$(/sbin/hwclock --systohc ${myopts} 2>&1 >/dev/null)" ]
|
errstr="$(LC_ALL=C /sbin/hwclock --systohc ${myopts} 2>&1 >/dev/null)"
|
||||||
retval=$?
|
if [ -n "${errstr}" ] ; then
|
||||||
|
ewarn "${errstr}"
|
||||||
|
retval=1
|
||||||
|
fi
|
||||||
errstr="Failed to sync clocks"
|
errstr="Failed to sync clocks"
|
||||||
else
|
else
|
||||||
retval=1
|
retval=1
|
||||||
errstr="/sbin/hwclock not found"
|
errstr="hwclock not found"
|
||||||
fi
|
fi
|
||||||
eend ${retval} "${errstr}"
|
eend ${retval} "${errstr}"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user