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
This commit is contained in:
Jarno Rantanen 2020-03-10 09:21:42 +02:00
parent 17aa8f6e00
commit 72f85b375d

View File

@ -27,6 +27,8 @@ SD_SIZE_SAFE=2800 # this is in MB
SD_SIZE_ZERO=3200 # this is in MB SD_SIZE_ZERO=3200 # this is in MB
SSH_PUBKEY="$(cat ~/.ssh/id_rsa.pub)" SSH_PUBKEY="$(cat ~/.ssh/id_rsa.pub)"
SSH_CONNECT_TIMEOUT=30 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 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 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" working "Finishing the root partition resize"
ssh "df -h . && sudo resize2fs /dev/mmcblk0p2 && df -h ." 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" working "Enabling auto-login to CLI"
# From: https://github.com/RPi-Distro/raspi-config/blob/985548d7ca00cab11eccbb734b63750761c1f08a/raspi-config#L955 # From: https://github.com/RPi-Distro/raspi-config/blob/985548d7ca00cab11eccbb734b63750761c1f08a/raspi-config#L955
SUDO_USER=pi SUDO_USER=pi