aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-07-02 00:08:25 +0700
committerShulhan <ms@kilabit.info>2022-07-25 19:29:22 +0700
commit632798d6b2a512d95670840b1f12e13b407829ec (patch)
tree7ebc2068b4a0044dad3a6ebcd8971ac41410f7d2
parent6b425a2b2f35fb90b00583fbf503f30816d2ebb7 (diff)
downloadcompute-archlinux-image-builder-632798d6b2a512d95670840b1f12e13b407829ec.tar.xz
all: use predefined files to setting up locale
This simplify updating and maintaining custom locale for user that does not want to use en_US.
-rwxr-xr-xbuild-arch-gce10
-rw-r--r--sys/etc/locale.conf1
-rw-r--r--sys/etc/locale.gen1
3 files changed, 7 insertions, 5 deletions
diff --git a/build-arch-gce b/build-arch-gce
index e1caf27..f9abc19 100755
--- a/build-arch-gce
+++ b/build-arch-gce
@@ -102,6 +102,10 @@ echo '-- Configuring NTP.'
mkdir -p $mount_dir/etc/systemd/timesyncd.conf.d/
cp ./sys/etc/systemd/timesyncd.conf.d/00-google.conf $mount_dir/etc/systemd/timesyncd.conf.d/
+echo '-- Configuring locale.'
+cp ./sys/etc/locale.gen $mount_dir/etc/locale.gen
+cp ./sys/etc/locale.conf $mount_dir/etc/locale.conf
+
arch-chroot -- "$mount_dir" /bin/bash -s <<-'EOS'
set -eEuo pipefail
trap 'echo "Error: \`$BASH_COMMAND\` exited with status $?"' ERR
@@ -110,12 +114,8 @@ arch-chroot -- "$mount_dir" /bin/bash -s <<-'EOS'
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
systemctl --quiet enable systemd-timesyncd.service
- echo '-- Configuring locale.'
- gawk -i assert -i inplace '
- /^#en_US\.UTF-8 UTF-8\s*$/ { $0 = substr($0, 2); ++f }
- { print } END { assert(f == 1, "f == 1") }' /etc/locale.gen
+ echo '-- Running locale-gen.'
locale-gen
- echo 'LANG=en_US.UTF-8' > /etc/locale.conf
echo '-- Configuring journald.'
gawk -i assert -i inplace '
diff --git a/sys/etc/locale.conf b/sys/etc/locale.conf
new file mode 100644
index 0000000..01ec548
--- /dev/null
+++ b/sys/etc/locale.conf
@@ -0,0 +1 @@
+LANG=en_US.UTF-8
diff --git a/sys/etc/locale.gen b/sys/etc/locale.gen
new file mode 100644
index 0000000..a66d814
--- /dev/null
+++ b/sys/etc/locale.gen
@@ -0,0 +1 @@
+en_US.UTF-8 UTF-8