From 2ad2196349e25d3af4beea2bfd444f85b987f9da Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 19 Jun 2014 10:18:46 +0200 Subject: [PATCH] build-sys: support ./configure ADJTIME_PATH= .. to override the default /etc/adjtime path. Reported-by: Bruce Dubbs Signed-off-by: Karel Zak --- Makefile.am | 1 + configure.ac | 6 ++++++ include/pathnames.h | 4 ++++ sys-utils/.gitignore | 2 ++ sys-utils/Makemodule.am | 2 ++ sys-utils/{hwclock.8 => hwclock.8.in} | 8 ++++---- sys-utils/{rtcwake.8 => rtcwake.8.in} | 8 +++++--- 7 files changed, 24 insertions(+), 7 deletions(-) rename sys-utils/{hwclock.8 => hwclock.8.in} (99%) rename sys-utils/{rtcwake.8 => rtcwake.8.in} (97%) diff --git a/Makefile.am b/Makefile.am index 1c52c5382..79b5aea78 100644 --- a/Makefile.am +++ b/Makefile.am @@ -117,6 +117,7 @@ edit_cmd = sed \ -e 's|@usrbin_execdir[@]|$(usrbin_execdir)|g' \ -e 's|@usrsbin_execdir[@]|$(usrsbin_execdir)|g' \ -e 's|@VERSION[@]|$(VERSION)|g' \ + -e 's|@ADJTIME_PATH[@]|$(ADJTIME_PATH)|g' \ -e 's|@LIBUUID_VERSION[@]|$(LIBUUID_VERSION)|g' \ -e 's|@LIBMOUNT_VERSION[@]|$(LIBMOUNT_VERSION)|g' \ -e 's|@LIBSMARTCOLS_VERSION[@]|$(LIBSMARTCOLS_VERSION)|g' \ diff --git a/configure.ac b/configure.ac index cf29f6bcd..1e9669ae9 100644 --- a/configure.ac +++ b/configure.ac @@ -1776,6 +1776,12 @@ AC_ARG_VAR([SOLIB_CFLAGS], AC_ARG_VAR([SOLIB_LDFLAGS], [LDFLAGS used for shared libraries]) +AC_ARG_VAR([ADJTIME_PATH], + [Path to hwclock adjtime file, default /etc/adjtime]) +AS_IF([test "x$ADJTIME_PATH" = x], [ADJTIME_PATH="/etc/adjtime"]) +AC_DEFINE_UNQUOTED([CONFIG_ADJTIME_PATH], "$ADJTIME_PATH", [Path to hwclock adjtime file]) + + LIBS="" diff --git a/include/pathnames.h b/include/pathnames.h index b6efdb7dc..1cc4e15e6 100644 --- a/include/pathnames.h +++ b/include/pathnames.h @@ -150,7 +150,11 @@ #define _PATH_DEV_BYPARTUUID "/dev/disk/by-partuuid" /* hwclock paths */ +#ifdef CONFIG_ADJTIME_PATH +# define _PATH_ADJTIME CONFIG_ADJTIME_PATH +#else # define _PATH_ADJTIME "/etc/adjtime" +#endif #define _PATH_LASTDATE "/var/lib/lastdate" #ifdef __ia64__ diff --git a/sys-utils/.gitignore b/sys-utils/.gitignore index d378b1d2f..0185a0e6e 100644 --- a/sys-utils/.gitignore +++ b/sys-utils/.gitignore @@ -20,3 +20,5 @@ sparc64.8 sparc.8 uname26.8 x86_64.8 +hwclock.8 +rtcwake.8 diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am index a2a1d6df2..68fd03046 100644 --- a/sys-utils/Makemodule.am +++ b/sys-utils/Makemodule.am @@ -104,6 +104,7 @@ endif if BUILD_RTCWAKE usrsbin_exec_PROGRAMS += rtcwake dist_man_MANS += sys-utils/rtcwake.8 +PATHFILES += sys-utils/rtcwake.8 rtcwake_SOURCES = sys-utils/rtcwake.c rtcwake_LDADD = $(LDADD) libcommon.la endif @@ -334,6 +335,7 @@ endif if BUILD_HWCLOCK sbin_PROGRAMS += hwclock dist_man_MANS += sys-utils/hwclock.8 +PATHFILES += sys-utils/hwclock.8 hwclock_SOURCES = \ sys-utils/hwclock.c \ sys-utils/hwclock.h \ diff --git a/sys-utils/hwclock.8 b/sys-utils/hwclock.8.in similarity index 99% rename from sys-utils/hwclock.8 rename to sys-utils/hwclock.8.in index 09f1edc5e..1e77269b1 100644 --- a/sys-utils/hwclock.8 +++ b/sys-utils/hwclock.8.in @@ -193,7 +193,7 @@ exist, the default is UTC time. .TP .B \-\-noadjfile Disables the facilities provided by -.IR /etc/adjtime . +.IR @ADJTIME_PATH@ . .B hwclock will not read nor write to that file with this option. Either .B \-\-utc @@ -203,7 +203,7 @@ must be specified when using this option. .TP .BI \-\-adjfile= filename -Overrides the default /etc/adjtime. +Overrides the default @ADJTIME_PATH@. .TP .BR \-f , \ \-\-rtc=\fIfilename\fB @@ -493,7 +493,7 @@ systematic drift. It works like this: .B hwclock keeps a file, -.IR /etc/adjtime , +.IR @ADJTIME_PATH@ , that keeps some historical information. This is called the adjtime file. .PP Suppose you start with no adjtime file. You issue a @@ -628,7 +628,7 @@ are supported by the hardware. .I TZ .SH FILES -.I /etc/adjtime +.I @ADJTIME_PATH@ .I /usr/share/zoneinfo/ .RI ( /usr/lib/zoneinfo on old systems) diff --git a/sys-utils/rtcwake.8 b/sys-utils/rtcwake.8.in similarity index 97% rename from sys-utils/rtcwake.8 rename to sys-utils/rtcwake.8.in index 02ab5cc15..643b59def 100644 --- a/sys-utils/rtcwake.8 +++ b/sys-utils/rtcwake.8.in @@ -61,17 +61,17 @@ Specifies an alternative path to the adjust file. .TP \fB-a\fP | \fB--auto\fP Reads the clock mode (whether the hardware clock is set to UTC or local time) -from \fI/etc/adjtime\fP. That's the location where the +from \fIadjtime\fP file. That's the location where the .BR hwclock (8) stores that information. This is the default. .TP \fB-l\fP | \fB--local\fP Assumes that the hardware clock is set to local time, regardless of the -contents of \fI/etc/adjtime\fP. +contents of \fIadjtime\fP file. .TP \fB-u\fP | \fB--utc\fP Assumes that the hardware clock is set to UTC (Universal Time Coordinated), -regardless of the contents of \fI/etc/adjtime\fP. +regardless of the contents of \fIadjtime\fP file. .TP \fB-d\fP \fIdevice\fP | \fB--device\fP \fIdevice\fP Uses \fIdevice\fP instead of \fIrtc0\fP as realtime clock. This option @@ -132,6 +132,8 @@ Print alarm information in format: "alarm: off|on