CLOUDSTACK-7143: cleanup configure_locale.sh code
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6a688a03 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6a688a03 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6a688a03 Branch: refs/heads/master Commit: 6a688a0337c4faa6b96552dccd620b3b58d00a4c Parents: aa14a61 Author: Leo Simons <lsim...@schubergphilis.com> Authored: Mon Jul 21 11:16:48 2014 +0200 Committer: Rohit Yadav <rohit.ya...@shapeblue.com> Committed: Mon Sep 22 21:31:35 2014 +0200 ---------------------------------------------------------------------- .../definitions/systemvmtemplate/configure_locale.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a688a03/tools/appliance/definitions/systemvmtemplate/configure_locale.sh ---------------------------------------------------------------------- diff --git a/tools/appliance/definitions/systemvmtemplate/configure_locale.sh b/tools/appliance/definitions/systemvmtemplate/configure_locale.sh index 6619c6c..8747a57 100644 --- a/tools/appliance/definitions/systemvmtemplate/configure_locale.sh +++ b/tools/appliance/definitions/systemvmtemplate/configure_locale.sh @@ -1,4 +1,14 @@ -fix_locale() { +#!/bin/bash + +set -e +set -x + +function configure_locale() { + grep LANG=en_US.UTF-8 /etc/default/locale && \ + grep LC_ALL=en_US.UTF-8 /etc/default/locale && \ + grep "en_US.UTF-8 UTF-8" /etc/locale.gen && + return + cat >> /etc/default/locale << EOF LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 @@ -10,4 +20,4 @@ EOF locale-gen en_US.UTF-8 } -fix_locale +return 2>/dev/null || configure_locale