configure: make default hwclockfile configurable
This commit is contained in:
parent
00a6394b48
commit
32f8bec92d
4 changed files with 15 additions and 5 deletions
|
@ -1595,9 +1595,11 @@ NTP, reference clocks or manual input.
|
|||
@node hwclockfile directive
|
||||
@subsection hwclockfile
|
||||
The @code{hwclockfile} directive sets the location of the adjtime file which is
|
||||
used by the @file{/sbin/hwclock} program. With this directive, @code{chronyd}
|
||||
will parse the file to find out if the RTC keeps local time or UTC. It
|
||||
overrides the @code{rtconutc} directive (@pxref{rtconutc directive}).
|
||||
used by the @file{/sbin/hwclock} program on Linux. @code{chronyd} parses the
|
||||
file to find out if the RTC keeps local time or UTC. It overrides the
|
||||
@code{rtconutc} directive (@pxref{rtconutc directive}).
|
||||
|
||||
The default value is @file{@DEFAULT_HWCLOCK_FILE@}.
|
||||
|
||||
An example of the command is
|
||||
|
||||
|
|
3
conf.c
3
conf.c
|
@ -124,7 +124,7 @@ static int enable_manual=0;
|
|||
static int rtc_on_utc = 0;
|
||||
|
||||
/* Filename used to read the hwclock(8) LOCAL/UTC setting */
|
||||
static char *hwclock_file = NULL;
|
||||
static char *hwclock_file;
|
||||
|
||||
/* Flag set if the RTC should be automatically synchronised by kernel */
|
||||
static int rtc_sync = 0;
|
||||
|
@ -324,6 +324,7 @@ CNF_Initialise(int r)
|
|||
bind_cmd_path = Strdup(DEFAULT_COMMAND_SOCKET);
|
||||
pidfile = Strdup("/var/run/chronyd.pid");
|
||||
rtc_device = Strdup("/dev/rtc");
|
||||
hwclock_file = Strdup(DEFAULT_HWCLOCK_FILE);
|
||||
user = Strdup(DEFAULT_USER);
|
||||
}
|
||||
|
||||
|
|
7
configure
vendored
7
configure
vendored
|
@ -102,6 +102,7 @@ For better control, use the options below.
|
|||
--with-ntp-era=SECONDS Specify earliest assumed NTP time in seconds
|
||||
since 1970-01-01 [50*365 days ago]
|
||||
--with-user=USER Specify default chronyd user [root]
|
||||
--with-hwclockfile=PATH Specify default path to hwclock(8) adjtime file
|
||||
--with-sendmail=PATH Path to sendmail binary [/usr/lib/sendmail]
|
||||
--enable-debug Enable debugging support
|
||||
|
||||
|
@ -214,6 +215,7 @@ feat_asyncdns=1
|
|||
feat_forcednsretry=1
|
||||
ntp_era_split=""
|
||||
default_user="root"
|
||||
default_hwclockfile=""
|
||||
mail_program="/usr/lib/sendmail"
|
||||
|
||||
for option
|
||||
|
@ -321,6 +323,9 @@ do
|
|||
--with-user=* )
|
||||
default_user=`echo $option | sed -e 's/^.*=//;'`
|
||||
;;
|
||||
--with-hwclockfile=* )
|
||||
default_hwclockfile=`echo $option | sed -e 's/^.*=//;'`
|
||||
;;
|
||||
--with-sendmail=* )
|
||||
mail_program=`echo $option | sed -e 's/^.*=//;'`
|
||||
;;
|
||||
|
@ -784,6 +789,7 @@ if [ "x$SETCHRONYVARDIR" != "x" ]; then
|
|||
fi
|
||||
|
||||
add_def DEFAULT_CONF_FILE "\"$SYSCONFDIR/chrony.conf\""
|
||||
add_def DEFAULT_HWCLOCK_FILE "\"$default_hwclockfile\""
|
||||
add_def DEFAULT_USER "\"$default_user\""
|
||||
add_def DEFAULT_COMMAND_SOCKET "\"$CHRONYSOCKDIR/chronyd.sock\""
|
||||
add_def MAIL_PROGRAM "\"$mail_program\""
|
||||
|
@ -824,6 +830,7 @@ do
|
|||
s%@LOCALSTATEDIR@%${LOCALSTATEDIR}%;\
|
||||
s%@CHRONYSOCKDIR@%${CHRONYSOCKDIR}%;\
|
||||
s%@CHRONYVARDIR@%${CHRONYVARDIR}%;\
|
||||
s%@DEFAULT_HWCLOCK_FILE@%${default_hwclockfile}%;\
|
||||
s%@DEFAULT_USER@%${default_user}%;"\
|
||||
< ${f}.in > $f
|
||||
done
|
||||
|
|
|
@ -382,7 +382,7 @@ read_hwclock_file(const char *hwclock_file)
|
|||
char line[256];
|
||||
int i;
|
||||
|
||||
if (!hwclock_file)
|
||||
if (!hwclock_file || !hwclock_file[0])
|
||||
return;
|
||||
|
||||
in = fopen(hwclock_file, "r");
|
||||
|
|
Loading…
Reference in a new issue