Changeset bd14dc3


Ignore:
Timestamp:
Dec 19, 2011 6:14:21 PM (9 years ago)
Author:
kytv <kytv@…>
Branches:
master
Children:
92b9d0a, ac8d65a
Parents:
cefe20f
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • installer/resources/i2prouter

    rcefe20f rbd14dc3  
    107107# flag for using upstart when installing (rather than init.d rc.d)
    108108USE_UPSTART=
     109
     110# Source the environment variables for the locale if $LANG isn't set
     111# If you want to set custom locale variables for I2P,
     112# you may comment out this block and set them yourself here.
     113
     114if [ ! -n $LANG ]; then
     115        for ENV_FILE in /etc/environment /etc/default/locale; do
     116                [ -r "$ENV_FILE" ] || continue
     117                [ -s "$ENV_FILE" ] || continue
     118
     119                for var in LANG LANGUAGE LC_ALL LC_CTYPE; do
     120                        value=`egrep "^${var}=" "$ENV_FILE" | tail -n1 | cut -d= -f2`
     121                        [ -n "$value" ] && eval export $var=$value
     122                done
     123        done
     124fi
    109125
    110126# When installing on On Mac OSX platforms, the following domain will be used to
Note: See TracChangeset for help on using the changeset viewer.