summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2014-11-11 19:37:17 +0000
committerdteske <dteske@FreeBSD.org>2014-11-11 19:37:17 +0000
commit403bbe3478e61b3278821c642872c7c3e938cc8d (patch)
treef02a9f063cbcc9c4b07aa4549f30e9127fdd9631 /usr.sbin
parenta75d2fd4af17b5b42c49afe06e1b28d268ac3e47 (diff)
downloadFreeBSD-src-403bbe3478e61b3278821c642872c7c3e938cc8d.zip
FreeBSD-src-403bbe3478e61b3278821c642872c7c3e938cc8d.tar.gz
Default `bsdconfig timezone' and `tzsetup' to `-s' in a VM.
Recommended by: cperciva Reviewed by: cperciva Relnotes: tzsetup and bsdconfig now assume that the "hardware" clock inside a VM is set to UTC
Diffstat (limited to 'usr.sbin')
-rwxr-xr-xusr.sbin/bsdconfig/timezone/timezone5
-rw-r--r--usr.sbin/tzsetup/tzsetup.c9
2 files changed, 13 insertions, 1 deletions
diff --git a/usr.sbin/bsdconfig/timezone/timezone b/usr.sbin/bsdconfig/timezone/timezone
index 0452230..66f2d78 100755
--- a/usr.sbin/bsdconfig/timezone/timezone
+++ b/usr.sbin/bsdconfig/timezone/timezone
@@ -62,7 +62,7 @@ _PATH_WALL_CMOS_CLOCK="/etc/wall_cmos_clock"
REALLYDOIT=1
REINSTALL=
USEDIALOG=1
-SKIPUTC=
+SKIPUTC= # See MAIN
VERBOSE=
TZ_OR_FAIL=
CHROOTENV=
@@ -119,6 +119,9 @@ dialog_menu_main()
############################################################ MAIN
+# Skip initial question regarding UTC v. Wall-Clock time if run in VM
+[ "$( sysctl -n kern.vm_guest 2> /dev/null )" = "none" ] || SKIPUTC=1
+
# Incorporate rc-file if it exists
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c
index cea8533..1750227 100644
--- a/usr.sbin/tzsetup/tzsetup.c
+++ b/usr.sbin/tzsetup/tzsetup.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
+#include <sys/sysctl.h>
#include <dialog.h>
@@ -910,8 +911,16 @@ main(int argc, char **argv)
{
char title[64], prompt[128];
int c, fd, rv, skiputc;
+ char vm_guest[16] = "";
+ size_t len = sizeof(vm_guest);
skiputc = 0;
+
+ /* Default skiputc to 1 for VM guests */
+ if (sysctlbyname("kern.vm_guest", vm_guest, &len, NULL, 0) == 0 &&
+ strcmp(vm_guest, "none") != 0)
+ skiputc = 1;
+
while ((c = getopt(argc, argv, "C:nrs")) != -1) {
switch(c) {
case 'C':
OpenPOWER on IntegriCloud