Browse Source

Added "tz" boot parameter for RTC timezone specification

tz=<timezone> or tz=:<timezone> boot parameter now sets
a corresponding TZ environment variable for "init" (pid=1) process,
which is then propagated further down the chain, since it is now
in OpenRC's "rc_env_allow". This is useful in tandem with "nontp"
boot option and non-UTC RTC.

Environment is now sanitized before running "init" -- only
TZ and/or TERM are passed through.

Removed default TZ=:UTC setting in main user and root's environment,
in order to use tz=<timezone> override if locale has not been
customized.
Maxim Kammerer 12 năm trước cách đây
mục cha
commit
bb5345ba68

+ 1 - 0
doc/changelog.txt

@@ -10,6 +10,7 @@
   * Reduced the number of SUID binaries via POSIX.1e capabilities
 
   * Replaced htpdate with NTP for time synchronization
+  * Added "tz" boot parameter for RTC timezone specification
   * Added "gentoo=nontp" boot parameter for disabling NTP
   * Added "gentoo=obfs" boot parameter for obfsproxy Tor bridges
   * Added "gentoo=xkms" boot parameter for forcing X modesetting driver

+ 2 - 2
src/etc/conf.d/hwclock

@@ -1,11 +1,11 @@
-# UTC / local (i.e., /etc/timezone) time in Hardware Clock
+# UTC / local (i.e., /etc/localtime) time in Hardware Clock
 # /etc/timezone is used by sys-libs/timezone-data for /etc/localtime
 clock="local"
 
 # Don't set Hardware Clock to System Time on shutdown
 clock_systohc="NO"
 
-# Not needed for kernel with RTC_HCTOSYS
+# Kernel with RTC_HCTOSYS does the same for UTC
 clock_hctosys="YES"
 
 # Other hwclock arguments

+ 1 - 0
src/etc/rc.conf

@@ -25,6 +25,7 @@ rc_logger="YES"
 # Environment for running scripts is filtered
 # rc_env_allow="*"
 # rc_env_allow="VAR1 VAR2"
+rc_env_allow="TZ"
 
 # By default all daemons are assumed to start correctly
 # Number of ms start-stop-daemon waits to check that the daemon is alive

+ 1 - 1
src/home/anon/config/shell/locale

@@ -1,4 +1,4 @@
+# export TZ=:UTC
 export LANG=en_GB.UTF-8
-export TZ=:UTC
 export X11_KBD_LAYOUT=us
 export X11_KBD_VARIANT=

+ 1 - 1
src/root/.profile

@@ -3,7 +3,7 @@ export LESS="-R -M --shift 16 -Swi -x4"
 export GZIP=-9
 
 export LANG=en_GB.UTF-8
-export TZ=:UTC
+# export TZ=:UTC
 
 if [ "${TERM}" = linux ]; then
     setterm -blength 0

+ 7 - 1
src/root/config/syslinux.cfg

@@ -22,12 +22,17 @@
 #     gentoo=nox         - disable X server configuration (manual "startx" is ok)
 #     gentoo=nologo      - disable desktop background logo (includes lock screen)
 #     gentoo=noanon      - non-anonymous mode with separate user settings (CAUTION)
-#     gentoo=nontp       - disable NTP time synchronization (clock must be in UTC)
+#
+#     tz=...             - real-time clock non-UTC timezone (+ default user timezone)
+#                          (see Time Zone column of "Language and Time Zone" applet)
+#     gentoo=nontp       - disable NTP time synchronization (use with tz=...)
 #
 #     bridges=...        - comma-separated list of Tor bridges: IP[:port(=443)]
 #     gentoo=obfs        - enable obfsproxy transport for bridges
+#
 # "gentoo=" prefix is optional, and can combine several comma-separated parameters
 #
+#
 # Other parameters: http://www.kernel.org/doc/Documentation/kernel-parameters.txt
 #                   http://www.kernel.org/doc/Documentation/fb/modedb.txt
 #     video=[driver:]800x600-32 - select framebuffer video mode
@@ -35,6 +40,7 @@
 #     quiet, debug, loglevel=n  - control kernel logging verbosity
 #     memtest=n                 - simple RAM test (lowmem-only on 32-bit kernel)
 #
+#
 # Video issues troubleshooting:
 #     video=LVDS-1:e (/ d)  - toggle video outputs (see /sys/class/drm)
 #     fbcon=map:1           - framebuffer driver should not take over the console

+ 1 - 1
src/root/initrd/init

@@ -247,7 +247,7 @@ umount /proc || bad_msg 'Failed to unmount /proc'
 
 cd ${slive}
 mount -o move /dev ${slive}/dev
-exec switch_root -c /dev/console ${slive} /sbin/init
+exec env - ${param_tz:+TZ=:"${param_tz#:}"} ${TERM:+TERM="${TERM}"} switch_root -c /dev/console ${slive} /sbin/init
 
 
 # If we get here, something bad has happened

+ 1 - 1
src/root/initrd/modules.global

@@ -9,7 +9,7 @@ drivers/mmc/card
 # Support booting from a PATA/SATA hard disk
 drivers/ata
 
-# SCSI includes CDROM and VM disks support
+# SCSI includes USB storage, CDROM and VM disks support
 drivers/scsi
 
 # Fusion MPT (e.g., for newer VMWare LSI Logic SCSI controller)