From bd14dc3112f8904bfe5ba201cac04e0efa52d11d Mon Sep 17 00:00:00 2001 From: kytv Date: Mon, 19 Dec 2011 18:14:21 +0000 Subject: [PATCH] i2prouter: set locale environment variables if LANG not set Check for /etc/environment and /etc/default/locale and retrieve/set locale variables from them--but only if LANG is unset. This should help in those cases in which someone is starting I2P as a daemon using an initscript and I2P is starting /before/ the environment is configured, leading to the wrong file encoding being detected. --- installer/resources/i2prouter | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/installer/resources/i2prouter b/installer/resources/i2prouter index 793555a01..f6d80be23 100644 --- a/installer/resources/i2prouter +++ b/installer/resources/i2prouter @@ -107,6 +107,22 @@ WAIT_FOR_STARTED_TIMEOUT=120 # flag for using upstart when installing (rather than init.d rc.d) USE_UPSTART= +# Source the environment variables for the locale if $LANG isn't set +# If you want to set custom locale variables for I2P, +# you may comment out this block and set them yourself here. + +if [ ! -n $LANG ]; then + for ENV_FILE in /etc/environment /etc/default/locale; do + [ -r "$ENV_FILE" ] || continue + [ -s "$ENV_FILE" ] || continue + + for var in LANG LANGUAGE LC_ALL LC_CTYPE; do + value=`egrep "^${var}=" "$ENV_FILE" | tail -n1 | cut -d= -f2` + [ -n "$value" ] && eval export $var=$value + done + done +fi + # When installing on On Mac OSX platforms, the following domain will be used to # prefix the plist file name. PLIST_DOMAIN=org.tanukisoftware.wrapper