Date: Tue, 11 Nov 2014 19:37:17 +0000 (UTC) From: Devin Teske <dteske@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r274394 - in head/usr.sbin: bsdconfig/timezone tzsetup Message-ID: <201411111937.sABJbHLl067878@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dteske Date: Tue Nov 11 19:37:17 2014 New Revision: 274394 URL: https://svnweb.freebsd.org/changeset/base/274394 Log: 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 Modified: head/usr.sbin/bsdconfig/timezone/timezone head/usr.sbin/tzsetup/tzsetup.c Modified: head/usr.sbin/bsdconfig/timezone/timezone ============================================================================== --- head/usr.sbin/bsdconfig/timezone/timezone Tue Nov 11 19:12:57 2014 (r274393) +++ head/usr.sbin/bsdconfig/timezone/timezone Tue Nov 11 19:37:17 2014 (r274394) @@ -62,7 +62,7 @@ _PATH_WALL_CMOS_CLOCK="/etc/wall_cmos_cl 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" Modified: head/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- head/usr.sbin/tzsetup/tzsetup.c Tue Nov 11 19:12:57 2014 (r274393) +++ head/usr.sbin/tzsetup/tzsetup.c Tue Nov 11 19:37:17 2014 (r274394) @@ -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':
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411111937.sABJbHLl067878>