From patchwork Sun Jul 12 22:55:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 494194 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 4A113140319 for ; Mon, 13 Jul 2015 08:55:58 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 7D7A7333CA; Sun, 12 Jul 2015 22:55:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MOOG3pzTRmld; Sun, 12 Jul 2015 22:55:53 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id E9669332B3; Sun, 12 Jul 2015 22:55:52 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 29EFE1C2847 for ; Sun, 12 Jul 2015 22:55:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id EB1839512F for ; Sun, 12 Jul 2015 22:55:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8Qmhi02nsnik for ; Sun, 12 Jul 2015 22:55:48 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from exchange.essensium.com (220.77.144.195.ipv4.evonet.be [195.144.77.220]) by hemlock.osuosl.org (Postfix) with ESMTPS id 58F8E9512A for ; Sun, 12 Jul 2015 22:55:48 +0000 (UTC) Received: from vandecaa-laptop.home (10.8.0.10) by beleexch01.local.ess-mail.com (10.3.7.8) with Microsoft SMTP Server (TLS) id 15.0.847.32; Mon, 13 Jul 2015 00:55:32 +0200 From: "Arnout Vandecappelle (Essensium/Mind)" To: Date: Mon, 13 Jul 2015 00:55:13 +0200 Message-ID: <1436741713-27300-1-git-send-email-arnout@mind.be> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1421684056-5266-6-git-send-email-maxtram95@gmail.com> References: <1421684056-5266-6-git-send-email-maxtram95@gmail.com> MIME-Version: 1.0 X-Originating-IP: [10.8.0.10] X-ClientProxiedBy: beleexch01.local.ess-mail.com (10.3.7.8) To beleexch01.local.ess-mail.com (10.3.7.8) Subject: [Buildroot] [PATCH v2] skeleton: apply locale settings in user shells X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Maxim Mikityanskiy Add /etc/profile.d/locale.sh script from Arch Linux to /etc/profile. This script looks for locale.conf, sources it, and exports the LANG and LC_* variables. [Arnout: put in /etc/profile in the skeleton rather than making it systemd specific.] Signed-off-by: Maxim Mikityanskiy Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- v2 [Arnout]: make the modification to /etc/profile in the skeleton rather than something systemd-specific - proposed by Samuel Martin. --- system/skeleton/etc/profile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/system/skeleton/etc/profile b/system/skeleton/etc/profile index 3812dda..c7438fe 100644 --- a/system/skeleton/etc/profile +++ b/system/skeleton/etc/profile @@ -35,6 +35,29 @@ if [ "$PS1" ]; then fi; +if [ -z "$LANG" ]; then + if [ -n $HOME ] && [ -r $HOME/.config/locale.conf ]; then + . "$HOME/.config/locale.conf" + elif [ -r /etc/locale.conf ]; then + . /etc/locale.conf + fi +fi + +LANG=${LANG:-C} +export LANG +[ -n "$LC_CTYPE" ] && export LC_CTYPE +[ -n "$LC_NUMERIC" ] && export LC_NUMERIC +[ -n "$LC_TIME" ] && export LC_TIME +[ -n "$LC_COLLATE" ] && export LC_COLLATE +[ -n "$LC_MONETARY" ] && export LC_MONETARY +[ -n "$LC_MESSAGES" ] && export LC_MESSAGES +[ -n "$LC_PAPER" ] && export LC_PAPER +[ -n "$LC_NAME" ] && export LC_NAME +[ -n "$LC_ADDRESS" ] && export LC_ADDRESS +[ -n "$LC_TELEPHONE" ] && export LC_TELEPHONE +[ -n "$LC_MEASUREMENT" ] && export LC_MEASUREMENT +[ -n "$LC_IDENTIFICATION" ] && export LC_IDENTIFICATION + # Source configuration files from /etc/profile.d for i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then