-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11-generate-utf-8
More file actions
executable file
·51 lines (39 loc) · 1.33 KB
/
11-generate-utf-8
File metadata and controls
executable file
·51 lines (39 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# 11-generate-utf-8
if [[ ${utf8Flag:-false} == true ]]; then
log_info 'Generating UTF-8.'
else
log_info 'UTF-8 generation skipped.'
return
fi
# {{{ 1. Ensure en_US.UTF-8 UTF-8 is uncommented in /etc/locale.gen
# - Handles commented and already-uncommented cases safely
sudo sed -i \
-e 's/^[[:space:]]*#\([[:space:]]*en_US\.UTF-8[[:space:]]\+UTF-8\)/\1/' \
/etc/locale.gen
# -------------------------------------------------------------------------- }}}
# {{{ 2. Generate locales
sudo locale-gen
# -------------------------------------------------------------------------- }}}
# {{{ 3. Set the system locale explicitly (Arch standard)
sudo tee /etc/locale.conf >/dev/null <<'EOF'
LANG=en_US.UTF-8
EOF
# -------------------------------------------------------------------------- }}}
# {{{ 4. Patch /etc/wsl.conf (prevent Windows PATH + locale interference)
if ! sudo grep -q '^\[interop\]' /etc/wsl.conf 2>/dev/null; then
sudo tee -a /etc/wsl.conf >/dev/null <<'EOF'
[interop]
enabled=true
appendWindowsPath=false
EOF
else
sudo sed -i \
-e '/^\[interop\]/,/^\[/{
s/^appendWindowsPath=.*/appendWindowsPath=false/;
t;
/^\[interop\]/a appendWindowsPath=false
}' \
/etc/wsl.conf
fi
# -------------------------------------------------------------------------- }}}