From b57c92d45870ca58cfe1bab4166ae515138e2b80 Mon Sep 17 00:00:00 2001
From: Marty Oehme <marty.oehme@gmail.com>
Date: Fri, 21 Feb 2025 16:02:11 +0100
Subject: [PATCH] feat(base): Only set glibc locales if we are in glibc
 installation

---
 void_base.yaml | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/void_base.yaml b/void_base.yaml
index 70d7987..d601286 100644
--- a/void_base.yaml
+++ b/void_base.yaml
@@ -86,7 +86,12 @@
         src: /usr/share/zoneinfo/{{ timezone }}
         state: link
 
-    - name: Set glibc locales
+    - name: Check if glibc locales exist
+      ansible.builtin.stat:
+        path: /etc/default/libc-locales
+      register: libc_locales_file
+
+    - name: Set correct glibc locales
       ansible.builtin.lineinfile:
         path: /etc/default/libc-locales
         regexp: "^{{ item }}"
@@ -94,6 +99,7 @@
         state: present
         create: true
       loop: "{{ locales_enabled }}"
+      when: libc_locales_file.stat.exists
       notify: glibc-locales-changed
 
   handlers:
@@ -104,4 +110,3 @@
           - --force
           - libc-locales
       listen: glibc-locales-changed
-