aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2011-01-27 09:12:02 +0100
committerThomas Bächler <thomas@archlinux.org>2011-01-27 09:12:02 +0100
commitef74507563bf994d6abb2621ebd3b6f6818b6b2f (patch)
tree330fffecee88b8976b0e227cde2f6c47aa4abbbf
parent32310a7cfd3288bb002f5479effd8328127d1249 (diff)
downloadinitscripts-ef74507563bf994d6abb2621ebd3b6f6818b6b2f.tar.xz
Allow setting the locale during boot and daemon startup.
This is configurable by the new rc.conf option DAEMON_LOCALE.
-rw-r--r--functions10
-rw-r--r--rc.conf3
2 files changed, 13 insertions, 0 deletions
diff --git a/functions b/functions
index b06d234..718d8c4 100644
--- a/functions
+++ b/functions
@@ -39,6 +39,16 @@ unset TERM_COLORS
# clear the TZ envvar, so daemons always respect /etc/localtime
unset TZ
+# sanitize the locale settins
+unset LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
+ LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE \
+ LC_MEASUREMENT LC_IDENTIFICATION LC_ALL
+if [[ $DAEMON_LOCALE =~ yes|YES && -n $LOCALE ]]; then
+ export LANG="${LOCALE}"
+else
+ export LANG=C
+fi
+
# colors:
if [[ $USECOLOR = YES || $USECOLOR = yes ]]; then
C_MAIN="\033[1;37;40m" # main text
diff --git a/rc.conf b/rc.conf
index de182c3..ee09bc2 100644
--- a/rc.conf
+++ b/rc.conf
@@ -7,6 +7,8 @@
# -----------------------------------------------------------------------
#
# LOCALE: available languages can be listed with the 'locale -a' command
+# DAEMON_LOCALE: Set the locale during daemon startup and during the boot
+# process. If set to 'no', the C locale will be used.
# HARDWARECLOCK: set to "UTC" or "localtime", any other value will result
# in the hardware clock being left untouched (useful for virtualization)
# TIMEZONE: timezones are found in /usr/share/zoneinfo
@@ -16,6 +18,7 @@
# USECOLOR: use ANSI color sequences in startup messages
#
LOCALE="en_US.UTF-8"
+DAEMON_LOCALE="no"
HARDWARECLOCK="localtime"
TIMEZONE="Canada/Pacific"
KEYMAP="us"