From 72f85b375d9da4bdd285baf0257093cd6a41148d Mon Sep 17 00:00:00 2001 From: Jarno Rantanen Date: Tue, 10 Mar 2020 09:21:42 +0200 Subject: [PATCH] Properly set locale for the image. This is to prevent e.g. the myriad of warnings during setup: perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_ADDRESS = "fi_FI.UTF-8", LC_NAME = "fi_FI.UTF-8", LC_MONETARY = "fi_FI.UTF-8", LC_PAPER = "fi_FI.UTF-8", LC_IDENTIFICATION = "fi_FI.UTF-8", LC_TELEPHONE = "fi_FI.UTF-8", LC_MEASUREMENT = "fi_FI.UTF-8", LC_TIME = "fi_FI.UTF-8", LC_NUMERIC = "fi_FI.UTF-8", LANG = "en_GB.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("en_GB.UTF-8"). locale: Cannot set LC_ALL to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory --- docs/image-setup.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/image-setup.sh b/docs/image-setup.sh index 57abd72..e7596af 100755 --- a/docs/image-setup.sh +++ b/docs/image-setup.sh @@ -27,6 +27,8 @@ SD_SIZE_SAFE=2800 # this is in MB SD_SIZE_ZERO=3200 # this is in MB SSH_PUBKEY="$(cat ~/.ssh/id_rsa.pub)" SSH_CONNECT_TIMEOUT=30 +LOCALE="en_US.UTF-8 UTF-8" # or e.g. "fi_FI.UTF-8 UTF-8" for Finland +LANGUAGE="en_US.UTF-8" # should match above KEYBOARD="us" # or e.g. "fi" for Finnish TIMEZONE="Etc/UTC" # or e.g. "Europe/Helsinki"; see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones @@ -173,6 +175,11 @@ done working "Finishing the root partition resize" ssh "df -h . && sudo resize2fs /dev/mmcblk0p2 && df -h ." +working "Setting locale" +ssh "echo $LOCALE | sudo tee /etc/locale.gen" +ssh "sudo locale-gen" +ssh "echo -e \"LANGUAGE=$LANGUAGE\nLC_ALL=$LANGUAGE\" | sudo tee /etc/environment" + working "Enabling auto-login to CLI" # From: https://github.com/RPi-Distro/raspi-config/blob/985548d7ca00cab11eccbb734b63750761c1f08a/raspi-config#L955 SUDO_USER=pi