From c6619d9b7ee6265c4dcf095758ddea3e85b110f0 Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Thu, 26 Sep 2019 19:42:06 +0200 Subject: [PATCH 1/2] [fix] Manage the case where there is no en_US locale commented I found a french vps provider with this issue --- install_yunohost | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/install_yunohost b/install_yunohost index 53f1fca..2ba542b 100755 --- a/install_yunohost +++ b/install_yunohost @@ -528,7 +528,12 @@ function fix_locales() { command -v locale-gen > /dev/null || apt_get_wrapper -o Dpkg::Options::="--force-confold" -y install locales # Generate at least en_US.UTF-8 - sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen && locale-gen + if grep "en_US.UTF-8" /etc/locale.gen; then + sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen + else + echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen + fi + locale-gen # If no /etc/environment exists, default to en_US.UTF-8 [ "$(grep LC_ALL /etc/environment)" ] || echo 'LC_ALL="en_US.UTF-8"' >> /etc/environment From 950b994ebbbaa77df0074d842fabd4b94aac0f54 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 1 Apr 2020 03:23:58 +0200 Subject: [PATCH 2/2] Simplify trick to generate locales --- install_yunohost | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/install_yunohost b/install_yunohost index 2ba542b..1cb39bf 100755 --- a/install_yunohost +++ b/install_yunohost @@ -528,11 +528,11 @@ function fix_locales() { command -v locale-gen > /dev/null || apt_get_wrapper -o Dpkg::Options::="--force-confold" -y install locales # Generate at least en_US.UTF-8 - if grep "en_US.UTF-8" /etc/locale.gen; then - sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen - else - echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen - fi + grep -q "^ *en_US.UTF-8" /etc/locale.gen || echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen + + # FIXME: here some day we should try to identify the user's lang from LANG or LC_ALL and generate the appropriate locale ... + # (and set this lang as the default in /etc/env 3 lines below) + locale-gen # If no /etc/environment exists, default to en_US.UTF-8