From f287134b37f0ae82675620d8d69790158e08475c Mon Sep 17 00:00:00 2001 From: Derek Date: Tue, 10 Nov 2026 18:35:40 +1100 Subject: [PATCH 1/2] revert: "feat(soe): enable ls/grep colour using each OS's own defaults (#79)" This reverts commit 7c77f61c1ab3a62d26a12ae251daaca7f4652a9c. The feat subject would trigger a minor release. The next commit reapplies the same change as a fix. semantic-release drops a reverted commit only when the revert names its exact header and hash. --- ansible/roles/soe/defaults/main.yml | 5 --- ansible/roles/soe/tasks/shell_config.yml | 53 ------------------------ 2 files changed, 58 deletions(-) diff --git a/ansible/roles/soe/defaults/main.yml b/ansible/roles/soe/defaults/main.yml index 3a8fd702..60341be7 100644 --- a/ansible/roles/soe/defaults/main.yml +++ b/ansible/roles/soe/defaults/main.yml @@ -55,8 +55,3 @@ soe_local_memory_limit: 1g # Seastar's own allocator reservation, which must stay under the container cap # or the broker is OOM-killed while warming up. soe_local_redpanda_seastar_memory: 700M - -# Where the ls/grep colour block goes. 'system' writes one block to the -# distro's interactive shell rc so every account gets it; 'user' writes to the -# invoking user's rc instead and needs no root. -soe_ls_colour_scope: system diff --git a/ansible/roles/soe/tasks/shell_config.yml b/ansible/roles/soe/tasks/shell_config.yml index 8499c040..6f008cbd 100644 --- a/ansible/roles/soe/tasks/shell_config.yml +++ b/ansible/roles/soe/tasks/shell_config.yml @@ -114,56 +114,3 @@ become: false when: ansible_facts['distribution'] == 'MacOSX' -# ============================================================================ -# ls / grep COLOURISATION (SYSTEM-WIDE, opt-out per user) -# ============================================================================ -# Uses only what each OS already ships - nothing installed. GNU ls (Linux, or -# macOS with brew coreutils) reads LS_COLORS; BSD ls (bare macOS) ignores it -# and reads LSCOLORS instead, so the block picks one at shell start. -# -# Colours are ANSI indices, not RGB, so they follow the terminal theme and need -# no light/dark handling of their own. -# -# Goes in the INTERACTIVE shell rc, not /etc/profile.d: aliases are not -# exported, and Ubuntu ships its profile.d hook commented out in -# /etc/bash.bashrc, so a terminal's non-login shell never reads it. -# -# Fedora already sets this system-wide via coreutils' colorls.sh, so there the -# block just sets the same thing again. On macOS /etc/zshrc is Apple's file and -# an OS update can replace it -- re-run the role after a major upgrade. -# -# Scope is soe_ls_colour_scope (see defaults/main.yml): 'system' for every -# account on the box, 'user' for just the invoking one. -- name: Resolve the ls/grep colour block and its target - ansible.builtin.set_fact: - soe_ls_colour_block: | - # Colour ls/grep using whatever this OS already ships - no packages. - # GNU (Linux, or macOS with brew coreutils) reads LS_COLORS and needs - # --color. BSD (bare macOS) reads LSCOLORS and needs CLICOLOR. - if command -v dircolors >/dev/null 2>&1; then - eval "$(dircolors -b)" - alias ls='ls --color=auto' - alias grep='grep --color=auto' - else - export CLICOLOR=1 - export LSCOLORS=ExFxBxDxCxegedabagacad - fi - soe_ls_colour_path: >- - {{ - (user_home ~ '/.zshrc') if soe_ls_colour_scope == 'user' and soe_mac - else (user_home ~ '/.bashrc') if soe_ls_colour_scope == 'user' - else '/etc/zshrc' if soe_mac - else '/etc/bashrc' if ansible_facts['distribution'] == 'Fedora' - else '/etc/bash.bashrc' - }} - vars: - soe_mac: "{{ ansible_facts['distribution'] == 'MacOSX' }}" - -- name: Enable ls/grep colour - ansible.builtin.blockinfile: - path: "{{ soe_ls_colour_path }}" - create: true - mode: '0644' - marker: "# {mark} HYPERI: ls colors" - block: "{{ soe_ls_colour_block }}" - become: "{{ soe_ls_colour_scope == 'system' }}" From 888c5386b84536a2e279f5666d5872f9fcd6ede4 Mon Sep 17 00:00:00 2001 From: Derek Date: Tue, 10 Nov 2026 18:35:53 +1100 Subject: [PATCH 2/2] fix(soe): enable ls/grep colour using each OS's own defaults Colouring is off on any box whose home directory did not come from the distro's own skel. A Fedora-derived .bashrc on Ubuntu leaves LS_COLORS empty and no ls alias, so ls and the prompt render monochrome. Uses only what each OS ships. GNU ls (Linux, or macOS with brew coreutils) reads LS_COLORS. BSD ls ignores LS_COLORS and reads LSCOLORS. The block detects which ls it has at shell start. Colours use ANSI indices rather than RGB. They track the terminal theme and need no light/dark handling. Solarized keeps 14 of 16 palette slots identical across its light and dark variants. The block goes in the interactive shell rc. Aliases are not exported. Ubuntu ships its profile.d hook commented out in /etc/bash.bashrc, so a terminal's non-login shell never reads /etc/profile.d. System-wide by default, soe_ls_colour_scope=user for a single account. --- ansible/roles/soe/defaults/main.yml | 5 +++ ansible/roles/soe/tasks/shell_config.yml | 53 ++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/ansible/roles/soe/defaults/main.yml b/ansible/roles/soe/defaults/main.yml index 60341be7..3a8fd702 100644 --- a/ansible/roles/soe/defaults/main.yml +++ b/ansible/roles/soe/defaults/main.yml @@ -55,3 +55,8 @@ soe_local_memory_limit: 1g # Seastar's own allocator reservation, which must stay under the container cap # or the broker is OOM-killed while warming up. soe_local_redpanda_seastar_memory: 700M + +# Where the ls/grep colour block goes. 'system' writes one block to the +# distro's interactive shell rc so every account gets it; 'user' writes to the +# invoking user's rc instead and needs no root. +soe_ls_colour_scope: system diff --git a/ansible/roles/soe/tasks/shell_config.yml b/ansible/roles/soe/tasks/shell_config.yml index 6f008cbd..8499c040 100644 --- a/ansible/roles/soe/tasks/shell_config.yml +++ b/ansible/roles/soe/tasks/shell_config.yml @@ -114,3 +114,56 @@ become: false when: ansible_facts['distribution'] == 'MacOSX' +# ============================================================================ +# ls / grep COLOURISATION (SYSTEM-WIDE, opt-out per user) +# ============================================================================ +# Uses only what each OS already ships - nothing installed. GNU ls (Linux, or +# macOS with brew coreutils) reads LS_COLORS; BSD ls (bare macOS) ignores it +# and reads LSCOLORS instead, so the block picks one at shell start. +# +# Colours are ANSI indices, not RGB, so they follow the terminal theme and need +# no light/dark handling of their own. +# +# Goes in the INTERACTIVE shell rc, not /etc/profile.d: aliases are not +# exported, and Ubuntu ships its profile.d hook commented out in +# /etc/bash.bashrc, so a terminal's non-login shell never reads it. +# +# Fedora already sets this system-wide via coreutils' colorls.sh, so there the +# block just sets the same thing again. On macOS /etc/zshrc is Apple's file and +# an OS update can replace it -- re-run the role after a major upgrade. +# +# Scope is soe_ls_colour_scope (see defaults/main.yml): 'system' for every +# account on the box, 'user' for just the invoking one. +- name: Resolve the ls/grep colour block and its target + ansible.builtin.set_fact: + soe_ls_colour_block: | + # Colour ls/grep using whatever this OS already ships - no packages. + # GNU (Linux, or macOS with brew coreutils) reads LS_COLORS and needs + # --color. BSD (bare macOS) reads LSCOLORS and needs CLICOLOR. + if command -v dircolors >/dev/null 2>&1; then + eval "$(dircolors -b)" + alias ls='ls --color=auto' + alias grep='grep --color=auto' + else + export CLICOLOR=1 + export LSCOLORS=ExFxBxDxCxegedabagacad + fi + soe_ls_colour_path: >- + {{ + (user_home ~ '/.zshrc') if soe_ls_colour_scope == 'user' and soe_mac + else (user_home ~ '/.bashrc') if soe_ls_colour_scope == 'user' + else '/etc/zshrc' if soe_mac + else '/etc/bashrc' if ansible_facts['distribution'] == 'Fedora' + else '/etc/bash.bashrc' + }} + vars: + soe_mac: "{{ ansible_facts['distribution'] == 'MacOSX' }}" + +- name: Enable ls/grep colour + ansible.builtin.blockinfile: + path: "{{ soe_ls_colour_path }}" + create: true + mode: '0644' + marker: "# {mark} HYPERI: ls colors" + block: "{{ soe_ls_colour_block }}" + become: "{{ soe_ls_colour_scope == 'system' }}"